Skip to content

Commit e70ddea

Browse files
viva-jinyigithub-actions
andauthored
fix: Add dropdown size control to Select components and improve UI (#5290)
* feature: size adjust * feature: design adjust * fix: popover width, height added * fix: li style override * refactor: improve component readability and maintainability per PR feedback - Replace CardGridList component with createGridStyle utility function - Add runtime validation for grid column values - Remove !important usage in MultiSelect, use cn() function instead - Extract popover sizing logic into usePopoverSizing composable - Improve class string readability by splitting into logical groups - Use Tailwind size utilities (size-8, size-10) instead of separate width/height - Remove magic numbers in SearchBox, align with button sizes - Rename BaseWidgetLayout to BaseModalLayout for clarity - Enhance SearchBox click area to cover entire component - Refactor long class strings using cn() utility across components * fix: BaseWidgetLayout => BaseModalLayout * fix: CardGrid deleted * fix: unused exported types * Update test expectations [skip ci] * chore: code review * Update test expectations [skip ci] * chore: restore screenshot --------- Co-authored-by: github-actions <[email protected]>
1 parent 038f86f commit e70ddea

23 files changed

+722
-426
lines changed

.storybook/preview-head.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@
5757

5858
/* Override Storybook's problematic & selector styles */
5959
/* Reset only the specific properties that Storybook injects */
60-
#storybook-root li+li,
61-
#storybook-docs li+li {
62-
margin: inherit;
63-
padding: inherit;
60+
li+li {
61+
margin: 0;
62+
padding: revert-layer;
6463
}
6564
</style>

src/components/button/IconButton.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
getButtonTypeClasses,
2222
getIconButtonSizeClasses
2323
} from '@/types/buttonTypes'
24+
import { cn } from '@/utils/tailwindUtil'
2425
2526
interface IconButtonProps extends BaseButtonProps {
2627
onClick: (event: Event) => void
@@ -46,8 +47,6 @@ const buttonStyle = computed(() => {
4647
? getBorderButtonTypeClasses(type)
4748
: getButtonTypeClasses(type)
4849
49-
return [baseClasses, sizeClasses, typeClasses, className]
50-
.filter(Boolean)
51-
.join(' ')
50+
return cn(baseClasses, sizeClasses, typeClasses, className)
5251
})
5352
</script>
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
<template>
2-
<div
3-
class="flex justify-center items-center shrink-0 outline-hidden border-none p-0 bg-white text-neutral-950 dark-theme:bg-zinc-700 dark-theme:text-white rounded-lg cursor-pointer"
4-
>
2+
<div :class="iconGroupClasses">
53
<slot></slot>
64
</div>
75
</template>
6+
7+
<script setup lang="ts">
8+
import { cn } from '@/utils/tailwindUtil'
9+
10+
const iconGroupClasses = cn(
11+
'flex justify-center items-center shrink-0',
12+
'outline-hidden border-none p-0 rounded-lg',
13+
'bg-white dark-theme:bg-zinc-700',
14+
'text-neutral-950 dark-theme:text-white',
15+
'cursor-pointer'
16+
)
17+
</script>

src/components/button/IconTextButton.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
getButtonSizeClasses,
2424
getButtonTypeClasses
2525
} from '@/types/buttonTypes'
26+
import { cn } from '@/utils/tailwindUtil'
2627
2728
defineOptions({
2829
inheritAttrs: false
@@ -52,8 +53,6 @@ const buttonStyle = computed(() => {
5253
? getBorderButtonTypeClasses(type)
5354
: getButtonTypeClasses(type)
5455
55-
return [baseClasses, sizeClasses, typeClasses, className]
56-
.filter(Boolean)
57-
.join(' ')
56+
return cn(baseClasses, sizeClasses, typeClasses, className)
5857
})
5958
</script>

src/components/button/MoreButton.vue

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
unstyled
1515
:pt="pt"
1616
>
17-
<div class="flex flex-col gap-1 p-2 min-w-40">
17+
<div class="flex flex-col gap-2 p-2 min-w-40">
1818
<slot :close="hide" />
1919
</div>
2020
</Popover>
@@ -25,6 +25,8 @@
2525
import Popover from 'primevue/popover'
2626
import { computed, ref } from 'vue'
2727
28+
import { cn } from '@/utils/tailwindUtil'
29+
2830
import IconButton from './IconButton.vue'
2931
3032
const popover = ref<InstanceType<typeof Popover>>()
@@ -39,13 +41,16 @@ const hide = () => {
3941
4042
const pt = computed(() => ({
4143
root: {
42-
class: 'absolute z-50'
44+
class: cn('absolute z-50')
4345
},
4446
content: {
45-
class: [
46-
'mt-2 bg-white dark-theme:bg-zinc-800 text-neutral dark-theme:text-white rounded-lg',
47-
'shadow-lg border border-zinc-200 dark-theme:border-zinc-700'
48-
]
47+
class: cn(
48+
'mt-2 rounded-lg',
49+
'bg-white dark-theme:bg-zinc-800',
50+
'text-neutral dark-theme:text-white',
51+
'shadow-lg',
52+
'border border-zinc-200 dark-theme:border-zinc-700'
53+
)
4954
}
5055
}))
5156
</script>

src/components/button/TextButton.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
getButtonSizeClasses,
2222
getButtonTypeClasses
2323
} from '@/types/buttonTypes'
24+
import { cn } from '@/utils/tailwindUtil'
2425
2526
interface TextButtonProps extends BaseButtonProps {
2627
label: string
@@ -48,8 +49,6 @@ const buttonStyle = computed(() => {
4849
? getBorderButtonTypeClasses(type)
4950
: getButtonTypeClasses(type)
5051
51-
return [baseClasses, sizeClasses, typeClasses, className]
52-
.filter(Boolean)
53-
.join(' ')
52+
return cn(baseClasses, sizeClasses, typeClasses, className)
5453
})
5554
</script>

0 commit comments

Comments
 (0)