Skip to content

Commit 8fedbdd

Browse files
committed
class as props
1 parent 5bc5e5a commit 8fedbdd

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

app/components/Button/Base.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const props = withDefaults(
44
'disabled'?: boolean
55
'type'?: 'button' | 'submit'
66
'variant'?: 'primary' | 'secondary'
7+
'class'?: string
78
'size'?: 'small' | 'medium'
89
'keyshortcut'?: string
910
@@ -33,7 +34,7 @@ defineExpose({
3334
<button
3435
ref="el"
3536
class="rounded-md outline-none group"
36-
:class="$attrs.class"
37+
:class="props.class"
3738
:type="props.type"
3839
:disabled="
3940
/**
@@ -47,13 +48,14 @@ defineExpose({
4748
:aria-keyshortcuts="keyshortcut"
4849
>
4950
<span
50-
class="group cursor-pointer inline-flex gap-x-1.5 relative items-center justify-center rounded-md hover:rounded-xl active:rounded-xl font-mono border border-solid transition-[background-color,color,border,outline] duration-200 transition-[border-radius_100ms] after:(content-[''] absolute inset--0.5 rounded-md) outline-transparent group-focus-visible:(outline-2 outline-accent outline-offset-2)"
51+
class="group cursor-pointer inline-flex gap-x-1.5 relative items-center justify-center rounded-md font-mono border border-solid transition-[background-color,color,border,outline] duration-200 transition-[border-radius_100ms] after:(content-[''] absolute inset--0.5 rounded-md) outline-transparent group-focus-visible:(outline-2 outline-accent outline-offset-2)"
5152
:class="{
5253
'text-sm px-4 py-2': size === 'medium',
5354
'text-xs px-2 py-0.5': size === 'small',
5455
'text-fg bg-transparent border-transparent hover:(bg-fg/10 border-fg/10)':
5556
variant === 'secondary',
56-
'text-bg bg-fg border-fg hover:(bg-fg/80)': variant === 'primary',
57+
'text-bg bg-fg border-fg hover:(bg-fg/80 rounded-xl) active:rounded-xl':
58+
variant === 'primary',
5759
'opacity-40 cursor-not-allowed border-transparent': disabled,
5860
}"
5961
>

app/components/Link/Base.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const props = withDefaults(
1212
'type'?: never
1313
'variant'?: 'button-primary' | 'button-secondary' | 'link'
1414
'size'?: 'small' | 'medium'
15+
'class'?: string
1516
1617
'keyshortcut'?: string
1718
@@ -62,7 +63,7 @@ const isButtonMedium = computed(() => props.size === 'medium' && props.variant !
6263
<span
6364
v-if="disabled"
6465
:class="{
65-
'opacity-50 inline-flex gap-x-1 items-center justify-center font-mono border border-red rounded-md':
66+
'opacity-50 inline-flex gap-x-1 items-center justify-center font-mono border rounded-md':
6667
isButton,
6768
'text-sm px-4 py-2': isButtonMedium,
6869
'text-xs px-2 py-0.5': isButtonSmall,
@@ -88,7 +89,7 @@ const isButtonMedium = computed(() => props.size === 'medium' && props.variant !
8889
'text-fg bg-transparent hover:(bg-fg/10 border-fg/10)': variant === 'button-secondary',
8990
'text-bg bg-fg border-fg hover:(bg-fg/80)': variant === 'button-primary',
9091
},
91-
$attrs.class,
92+
props.class,
9293
]"
9394
:to="to"
9495
:aria-keyshortcuts="keyshortcut"

0 commit comments

Comments
 (0)