File tree Expand file tree Collapse file tree 2 files changed +61
-2
lines changed Expand file tree Collapse file tree 2 files changed +61
-2
lines changed Original file line number Diff line number Diff line change 49
49
<hr class =" mb-3.5" />
50
50
<ul >
51
51
<li v-for =" item in items" :key =" item.title" >
52
- <SfListItem tag =" a " :href =" item.link" size =" sm" role =" none"
52
+ <ListItem : tag =" NuxtLink " :href =" item.link" size =" sm" role =" none"
53
53
class =" typography-text-base md:typography-text-sm py-4 md:py-1.5" >
54
54
{{ item.title }}
55
- </SfListItem >
55
+ </ListItem >
56
56
</li >
57
57
</ul >
58
58
</div >
80
80
</div >
81
81
</template >
82
82
<script lang="ts" setup>
83
+ import { NuxtLink } from ' #components' ;
83
84
import {
84
85
SfButton ,
85
86
SfDrawer ,
@@ -95,6 +96,7 @@ import {
95
96
import { ref } from ' vue' ;
96
97
import { onClickOutside } from ' @vueuse/core' ;
97
98
import { sdk } from " ~/sdk.config" ;
99
+ import ListItem from " ~/components/ui/ListItem.vue" ;
98
100
99
101
const { isOpen, toggle, close } = useDisclosure ();
100
102
const menuRef = ref ();
Original file line number Diff line number Diff line change
1
+ <script lang="ts">
2
+
3
+
4
+ import {SfListItemSize } from " @storefront-ui/vue" ;
5
+ export const sizeClasses = {
6
+ [SfListItemSize .sm ]: ' text-sm px-4 py-1' ,
7
+ [SfListItemSize .base ]: ' px-4 py-2' ,
8
+ [SfListItemSize .lg ]: ' p-4' ,
9
+ };
10
+ </script >
11
+
12
+ <script setup lang="ts">
13
+ import { type PropType , type ConcreteComponent } from ' vue' ;
14
+ import { SfListItemSize } from ' @storefront-ui/vue' ;
15
+
16
+ defineProps ({
17
+ size: {
18
+ type: String as PropType <` ${SfListItemSize } ` >,
19
+ default: SfListItemSize .base ,
20
+ },
21
+ disabled: {
22
+ type: Boolean ,
23
+ default: undefined ,
24
+ },
25
+ selected: {
26
+ type: Boolean ,
27
+ default: false ,
28
+ },
29
+ tag: {
30
+ type: [String , Object ] as PropType <string | ConcreteComponent >,
31
+ default: ' a' ,
32
+ },
33
+ });
34
+ </script >
35
+
36
+ <template >
37
+ <component
38
+ :is =" tag || 'li'"
39
+ :class =" [
40
+ 'inline-flex items-center gap-2 w-full hover:bg-neutral-100 active:bg-neutral-200 cursor-pointer focus-visible:outline focus-visible:outline-offset focus-visible:relative focus-visible:z-10',
41
+ sizeClasses[size],
42
+ { 'cursor-not-allowed pointer-events-none text-disabled-900': disabled, 'font-medium': selected },
43
+ ]"
44
+ :disabled =" disabled"
45
+ data-testid =" list-item"
46
+ >
47
+ <span v-if =" $slots.prefix" :class =" disabled ? 'text-disabled-500' : 'text-neutral-500'" >
48
+ <slot name =" prefix" />
49
+ </span >
50
+ <span class =" flex flex-col w-full min-w-0" >
51
+ <slot />
52
+ </span >
53
+ <span v-if =" $slots.suffix" :class =" disabled ? 'text-disabled-500' : 'text-neutral-500'" >
54
+ <slot name =" suffix" />
55
+ </span >
56
+ </component >
57
+ </template >
You can’t perform that action at this time.
0 commit comments