1
1
<script setup lang="ts">
2
- const { clear, user } = useUserSession ();
3
- const colorMode = useColorMode ();
4
-
5
- const isDarkMode = computed ({
6
- get : () => colorMode .preference === ' dark' ,
7
- set : () => (colorMode .preference = colorMode .value === ' dark' ? ' light' : ' dark' ),
8
- });
9
-
10
- const items = [
11
- [{ label: ' Profile' , slot: ' account' }],
12
- [{ label: ' Theme' , slot: ' theme' , click : () => (isDarkMode .value = ! isDarkMode .value ) }],
13
- [{ label: ' Sign out' , click : () => clear () }],
14
- ];
15
-
16
2
const createHabitModal = ref (false );
17
3
</script >
18
4
@@ -22,35 +8,7 @@ const createHabitModal = ref(false);
22
8
<UIcon name =" i-heroicons-plus-16-solid" class =" h-5 w-5" />
23
9
Create
24
10
</button >
25
-
26
- <UDropdown :items =" items" :popper =" { placement: 'bottom-end' }" >
27
- <button class =" button bg-white/20 p-1.5 hover:bg-white/25" >
28
- <UIcon name =" i-heroicons-cog-8-tooth" class =" h-5 w-5" />
29
- </button >
30
- <template #account >
31
- <div class =" flex items-center gap-2.5" >
32
- <UAvatar :src =" user?.avatar_url" size =" md" />
33
- <div class =" text-left" >
34
- <p >{{ user?.name }}</p >
35
- <p class =" truncate font-medium text-gray-900 dark:text-white" >@{{ user?.login }}</p >
36
- </div >
37
- </div >
38
- </template >
39
-
40
- <template #theme >
41
- <div class =" flex flex-1 items-center justify-between" >
42
- <span class =" truncate" >Dark mode</span >
43
- <UIcon
44
- :name =" colorMode.preference === 'dark' || colorMode.preference === 'system' ? 'i-heroicons-moon' : 'i-heroicons-sun'"
45
- class =" ms-auto h-5 w-5 flex-shrink-0 text-gray-400" />
46
- </div >
47
- </template >
48
-
49
- <template #item >
50
- <span class =" truncate" >Sign out</span >
51
- <UIcon name =" i-heroicons-arrow-right-on-rectangle-20-solid" class =" ms-auto h-5 w-5 flex-shrink-0 text-gray-400" />
52
- </template >
53
- </UDropdown >
11
+ <Dropdown />
54
12
</div >
55
13
<UModal v-model =" createHabitModal" :ui =" { width: 'w-80', background: '', shadow: '', overlay: { base: 'backdrop-blur-2xl', background: 'dark:bg-black/60' } }" >
56
14
<HabitForm @habitAdded =" createHabitModal = false" />
0 commit comments