forked from carbon-design-system/carbon-components-svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SideNav should overlay Content in UIShell
- Loading branch information
Showing
2 changed files
with
3 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
<script> | ||
/** Specify the id for the main element */ | ||
export let id = "main-content"; | ||
import { isSideNavCollapsed, 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 = $isSideNavCollapsed && !$isSideNavRail; | ||
</script> | ||
|
||
<main | ||
id="{id}" | ||
class:bx--content="{true}" | ||
{...$$restProps} | ||
style="{unsetLeftMargin ? 'margin-left: 0;' : ''} {$$restProps.style}" | ||
> | ||
<main id="{id}" class:bx--content="{true}" {...$$restProps}> | ||
<slot /> | ||
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters