Skip to content

Commit

Permalink
feat(Sidebar): add minScreen prop
Browse files Browse the repository at this point in the history
  • Loading branch information
JollyBanny authored Oct 30, 2024
1 parent 83419c4 commit 86207fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/www/src/lib/registry/new-york/ui/sidebar/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ const props = withDefaults(defineProps<{
side?: 'left' | 'right'
variant?: 'sidebar' | 'floating' | 'inset'
collapsible?: 'offcanvas' | 'icon' | 'none'
minScreen?: 'sm' | 'md' | 'lg'
class?: HTMLAttributes['class']
}>(), {
side: 'left',
variant: 'sidebar',
collapsible: 'offcanvas',
minScreen: 'md'
})
const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
Expand Down Expand Up @@ -53,6 +55,7 @@ const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
:data-collapsible="state === 'collapsed' ? collapsible : ''"
:data-variant="variant"
:data-side="side"
:class="{ 'sm:block': minScreen === 'sm', 'md:block': minScreen === 'md', 'lg:block': minScreen === 'lg' }"
>
<!-- This is what handles the sidebar gap on desktop -->
<div
Expand All @@ -75,6 +78,7 @@ const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
variant === 'floating' || variant === 'inset'
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'
: 'group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l',
{ 'sm:block': minScreen === 'sm', 'md:block': minScreen === 'md', 'lg:block': minScreen === 'lg' }
props.class,
)"
v-bind="$attrs"
Expand Down

0 comments on commit 86207fe

Please sign in to comment.