Previous commit was removing margin-left: 0

style. This revert back this change and add more
consistencies with the `navStore` and classes.
This commit is contained in:
jqlio18 2022-12-14 12:58:44 -05:00
commit 717d6d88de
3 changed files with 26 additions and 2 deletions

View file

@ -1,8 +1,24 @@
<script>
/** Specify the id for the main element */
export let id = "main-content";
import { isSideNavExpanded, isSideNavRail } from "./navStore";
/**
* By default, the `SideNav` applies a left margin of `3rem` to `Content`
* if it's a sibling component (e.g., .bx--side-nav ~ .bx--content).
*
* We manually unset the left margin if the `SideNav`
* is collapsed and if it's not the `rail` variant.
*/
$: unsetLeftMargin = !$isSideNavRail && !$isSideNavExpanded;
</script>
<main id="{id}" class:bx--content="{true}" {...$$restProps}>
<main
id="{id}"
class:bx--content="{true}"
style="{unsetLeftMargin ? 'margin-left: 0' : ''}"
{...$$restProps}
>
<slot />
</main>