Skip to content

Commit 6fa726e

Browse files
fix: sidebar dropdown open position (#71)
* fix: sidebar open position This update aligns the vue-starter-kit with react-starter-kit regarding the sidebar dropdown * Update NavUser.vue --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent bb6a736 commit 6fa726e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

resources/js/components/NavUser.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<script setup lang="ts">
22
import UserInfo from '@/components/UserInfo.vue';
33
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
4-
import { SidebarMenu, SidebarMenuButton, SidebarMenuItem } from '@/components/ui/sidebar';
4+
import { SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar } from '@/components/ui/sidebar';
55
import { type SharedData, type User } from '@/types';
66
import { usePage } from '@inertiajs/vue3';
77
import { ChevronsUpDown } from 'lucide-vue-next';
88
import UserMenuContent from './UserMenuContent.vue';
99
1010
const page = usePage<SharedData>();
1111
const user = page.props.auth.user as User;
12+
const { isMobile, state } = useSidebar();
1213
</script>
1314

1415
<template>
@@ -21,7 +22,12 @@ const user = page.props.auth.user as User;
2122
<ChevronsUpDown class="ml-auto size-4" />
2223
</SidebarMenuButton>
2324
</DropdownMenuTrigger>
24-
<DropdownMenuContent class="w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg" side="bottom" align="end" :side-offset="4">
25+
<DropdownMenuContent
26+
class="w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg"
27+
:side="isMobile ? 'bottom' : state === 'collapsed' ? 'left' : 'bottom'"
28+
align="end"
29+
:side-offset="4"
30+
>
2531
<UserMenuContent :user="user" />
2632
</DropdownMenuContent>
2733
</DropdownMenu>

0 commit comments

Comments
 (0)