Skip to content

Commit

Permalink
✨ Add Sidebar in Sheet example
Browse files Browse the repository at this point in the history
  • Loading branch information
Frontendland committed Oct 1, 2024
1 parent 1df316e commit 49d8ef4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ export const getSections = ({
return [
{
title: `Astro ${title}`,
type: 'astro',
component: components[0],
...(props && props)
},
...(components[1] ? [{
title: `Svelte ${title}`,
type: 'svelte',
component: components[1],
...(showSubTitle && {
subTitle: 'For interactive examples, visit <a href="/svelte">Svelte Playground</a>'
Expand All @@ -20,6 +22,7 @@ export const getSections = ({
}] : []),
...(components[2] ? [{
title: `React ${title}`,
type: 'react',
component: components[2],
...(showSubTitle && {
subTitle: 'For interactive examples, visit <a href="/react">React Playground</a>'
Expand Down
31 changes: 31 additions & 0 deletions src/pages/sidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import ComponentWrapper from '@static/ComponentWrapper.astro'
import Layout from '@static/Layout.astro'
import Button from '@components/Button/Button.astro'
import Sheet from '@components/Sheet/Sheet.astro'
import AstroSidebar from '@components/Sidebar/Sidebar.astro'
import SvelteSidebar from '@components/Sidebar/Sidebar.svelte'
import ReactSidebar from '@components/Sidebar/Sidebar.tsx'
Expand Down Expand Up @@ -69,6 +71,35 @@ const sections = getSections({
<ComponentWrapper title="Sidebar with icons & states">
<section.component groups={itemGroupsWithIcons} />
</ComponentWrapper>

{section.type === 'astro' && (
<ComponentWrapper title="Sidebar sheet">
<Button theme="secondary" id="open-sidebar">
Open Sidebar
</Button>
<Sheet
id="sidebar"
position="left"
>
<section.component groups={itemGroupsWithIcons} />
</Sheet>
</ComponentWrapper>
)}
</div>
))}
</Layout>

<style>
#sidebar {
width: 300px;
}
</style>

<script>
import { modal } from '@utils/modal'

modal({
trigger: '#open-sidebar',
modal: '#sidebar'
})
</script>

0 comments on commit 49d8ef4

Please sign in to comment.