mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-17 11:11:25 +00:00
fix(ui-shell): do not unset Content
left margin for rail SideNav
(#1462)
Fixes #1459
This commit is contained in:
parent
1e9a34808f
commit
5bafda10f9
3 changed files with 19 additions and 3 deletions
|
@ -2,14 +2,23 @@
|
|||
/** Specify the id for the main element */
|
||||
export let id = "main-content";
|
||||
|
||||
import { isSideNavCollapsed } from "./navStore";
|
||||
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="{$isSideNavCollapsed && 'margin-left: 0;'} {$$restProps.style}}"
|
||||
style="{unsetLeftMargin && 'margin-left: 0;'} {$$restProps.style}}"
|
||||
>
|
||||
<slot />
|
||||
</main>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue