Skip to content

Commit 3d3d94f

Browse files
authored
Merge pull request #182 from fortanix/fix/applayout-without-sidebar
Fix AppLayout css without sidebar
2 parents ad0ecd4 + d0e437d commit 3d3d94f

File tree

2 files changed

+88
-4
lines changed

2 files changed

+88
-4
lines changed

src/layouts/AppLayout/AppLayout.module.scss

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,18 @@
2929
display: grid;
3030
// Note: use `minmax(0, 1fr)` to prevent blowout: https://css-tricks.com/preventing-a-grid-blowout
3131
grid:
32-
'header header' var(--bk-app-layout-header-height)
33-
'sidebar content' 1fr
34-
'sidebar footer' max-content
35-
/ var(--bk-app-layout-sidebar-width) minmax(0, 1fr);
32+
'header' var(--bk-app-layout-header-height)
33+
'content' 1fr
34+
'footer' max-content
35+
/ minmax(0, 1fr);
36+
37+
&:has(> [slot='sidebar']) {
38+
grid:
39+
'header header' var(--bk-app-layout-header-height)
40+
'sidebar content' 1fr
41+
'sidebar footer' max-content
42+
/ var(--bk-app-layout-sidebar-width) minmax(0, 1fr);
43+
}
3644

3745
> [slot='header'] { grid-area: header; }
3846
> [slot='sidebar'] { grid-area: sidebar; }

src/layouts/AppLayout/AppLayout.stories.tsx

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,79 @@ export const Standard: Story = {
131131
),
132132
},
133133
};
134+
135+
export const NoSidebar: Story = {
136+
args: {
137+
children: (
138+
<>
139+
<AppLayout.Header>
140+
<DummyLink slot="logo">
141+
<Logo subtitle="Data Security Manager" subtitleTrademark={true}/>
142+
</DummyLink>
143+
<Header slot="actions">
144+
<UserMenu userName="Anand Kashyap">
145+
<UserMenu.Action itemKey="profile" label="Profile"
146+
onActivate={() => { notify.info(`Opening user profile.`); }}
147+
/>
148+
<UserMenu.Action itemKey="sign-out" label="Sign out"
149+
onActivate={() => { notify.info(`Signing out.`); }}
150+
/>
151+
</UserMenu>
152+
<SysadminSwitcher
153+
onPress={() => { notify.info(`Navigating to system administration panel.`); }}
154+
/>
155+
<AccountSelector className="select-action">
156+
{Array.from({ length: 30 }, (_, index) => `Account ${index + 1}`).map(name =>
157+
<AccountSelector.Option key={`account_${name}`} optionKey={`account_${name}`} icon="account"
158+
label={name}
159+
onSelect={() => { notify.info(`Selected ${name}`); }}
160+
/>
161+
)}
162+
{/* TODO: make this sticky so it's visible even if there are a lot of accounts? */}
163+
<AccountSelector.Option key="action_add-account" optionKey="action_add-account" label="Add account"/>
164+
</AccountSelector>
165+
<SolutionSelector className="select-action">
166+
{['Identity & Access Management', 'Key Insight', 'Data Security Manager'].map(name =>
167+
<SolutionSelector.Option key={name} optionKey={name} icon="user" label={name}
168+
onSelect={() => { notify.info(`Selected ${name}`); }}
169+
/>
170+
)}
171+
</SolutionSelector>
172+
</Header>
173+
</AppLayout.Header>
174+
<AppLayout.Content>
175+
<Breadcrumbs
176+
items={[
177+
{
178+
title: 'Data Security Manager',
179+
href: '#',
180+
},
181+
{
182+
title: 'Dashboard',
183+
href: '#',
184+
}
185+
]}
186+
/>
187+
<Panel>
188+
<Panel.Heading>Panel</Panel.Heading>
189+
190+
<DialogModal
191+
title="Modal"
192+
trigger={({ activate }) => <Button kind="primary" label="Open modal" onPress={() => { activate(); }}/>}
193+
>
194+
Test
195+
</DialogModal>
196+
</Panel>
197+
198+
{/* Clicking the link should scroll to the anchor, with enough top padding (`scroll-padding-top`) */}
199+
<DummyLink id="anchor">Anchor</DummyLink>
200+
<OverflowTester openDefault/>
201+
<a href="#anchor">Scroll to anchor</a>
202+
</AppLayout.Content>
203+
<AppLayout.Footer>
204+
<span className="version">Version: 1.2.2343</span>
205+
</AppLayout.Footer>
206+
</>
207+
),
208+
},
209+
};

0 commit comments

Comments
 (0)