Skip to content

Commit 49d8ef4

Browse files
committed
✨ Add Sidebar in Sheet example
1 parent 1df316e commit 49d8ef4

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/helpers.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ export const getSections = ({
77
return [
88
{
99
title: `Astro ${title}`,
10+
type: 'astro',
1011
component: components[0],
1112
...(props && props)
1213
},
1314
...(components[1] ? [{
1415
title: `Svelte ${title}`,
16+
type: 'svelte',
1517
component: components[1],
1618
...(showSubTitle && {
1719
subTitle: 'For interactive examples, visit <a href="/svelte">Svelte Playground</a>'
@@ -20,6 +22,7 @@ export const getSections = ({
2022
}] : []),
2123
...(components[2] ? [{
2224
title: `React ${title}`,
25+
type: 'react',
2326
component: components[2],
2427
...(showSubTitle && {
2528
subTitle: 'For interactive examples, visit <a href="/react">React Playground</a>'

src/pages/sidebar.astro

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import ComponentWrapper from '@static/ComponentWrapper.astro'
33
import Layout from '@static/Layout.astro'
44
5+
import Button from '@components/Button/Button.astro'
6+
import Sheet from '@components/Sheet/Sheet.astro'
57
import AstroSidebar from '@components/Sidebar/Sidebar.astro'
68
import SvelteSidebar from '@components/Sidebar/Sidebar.svelte'
79
import ReactSidebar from '@components/Sidebar/Sidebar.tsx'
@@ -69,6 +71,35 @@ const sections = getSections({
6971
<ComponentWrapper title="Sidebar with icons & states">
7072
<section.component groups={itemGroupsWithIcons} />
7173
</ComponentWrapper>
74+
75+
{section.type === 'astro' && (
76+
<ComponentWrapper title="Sidebar sheet">
77+
<Button theme="secondary" id="open-sidebar">
78+
Open Sidebar
79+
</Button>
80+
<Sheet
81+
id="sidebar"
82+
position="left"
83+
>
84+
<section.component groups={itemGroupsWithIcons} />
85+
</Sheet>
86+
</ComponentWrapper>
87+
)}
7288
</div>
7389
))}
7490
</Layout>
91+
92+
<style>
93+
#sidebar {
94+
width: 300px;
95+
}
96+
</style>
97+
98+
<script>
99+
import { modal } from '@utils/modal'
100+
101+
modal({
102+
trigger: '#open-sidebar',
103+
modal: '#sidebar'
104+
})
105+
</script>

0 commit comments

Comments
 (0)