refactor(ui): seçim bileşeninin görsel etkileşimini modernize et.

This commit is contained in:
2026-01-09 18:26:46 +03:00
parent 8089a816ad
commit 79068c0faa
5 changed files with 48 additions and 9 deletions

View File

@@ -28,6 +28,7 @@
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.19",
"postcss": "^8.4.39", "postcss": "^8.4.39",
"tailwindcss": "^3.4.6", "tailwindcss": "^3.4.6",
"tailwindcss-animate": "^1.0.7",
"typescript": "^5.5.3", "typescript": "^5.5.3",
"vite": "^5.3.3" "vite": "^5.3.3"
} }

View File

@@ -51,7 +51,17 @@ export const Select = SelectPrimitive.Root;
export const SelectGroup = SelectPrimitive.Group; export const SelectGroup = SelectPrimitive.Group;
export const SelectValue = SelectPrimitive.Value; export const SelectValue = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Value>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Value>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Value
ref={ref}
className={clsx("block truncate", className)}
{...props}
/>
));
SelectValue.displayName = "SelectValue";
export const SelectLabel = SelectPrimitive.Label; export const SelectLabel = SelectPrimitive.Label;
@@ -62,14 +72,14 @@ export const SelectTrigger = React.forwardRef<
<SelectPrimitive.Trigger <SelectPrimitive.Trigger
ref={ref} ref={ref}
className={clsx( className={clsx(
"flex h-10 w-full items-center justify-between gap-2 rounded-md border border-slate-200 bg-white px-3 text-sm text-slate-700 shadow-sm transition focus:outline-none focus:ring-2 focus:ring-slate-300 data-[placeholder]:text-slate-400", "inline-flex h-10 flex-shrink-0 items-center justify-between gap-2 whitespace-nowrap rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 shadow-sm transition focus:outline-none focus:ring-2 focus:ring-slate-300 data-[placeholder]:text-slate-400 disabled:cursor-not-allowed disabled:opacity-50 [&_[data-radix-select-trigger-icon-wrapper]]:shrink-0",
className className
)} )}
{...props} {...props}
> >
<span className="line-clamp-1">{children}</span> {children}
<SelectPrimitive.Icon asChild> <SelectPrimitive.Icon asChild>
<ChevronDown className="h-4 w-4 text-slate-400" /> <ChevronDown className="h-4 w-4 shrink-0 opacity-50" />
</SelectPrimitive.Icon> </SelectPrimitive.Icon>
</SelectPrimitive.Trigger> </SelectPrimitive.Trigger>
)); ));
@@ -117,7 +127,9 @@ export const SelectContent = React.forwardRef<
<SelectPrimitive.Content <SelectPrimitive.Content
ref={ref} ref={ref}
className={clsx( className={clsx(
"relative z-50 max-h-72 min-w-[8rem] overflow-hidden rounded-md border border-slate-200 bg-white text-slate-700 shadow-md", "relative z-50 max-h-72 overflow-hidden rounded-md border border-slate-200 bg-white text-slate-700 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
position === "popper" &&
"min-w-[var(--radix-select-trigger-width)] w-[var(--radix-select-trigger-width)] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className className
)} )}
position={position} position={position}
@@ -129,7 +141,7 @@ export const SelectContent = React.forwardRef<
className={clsx( className={clsx(
"p-1", "p-1",
position === "popper" && position === "popper" &&
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]" "h-[var(--radix-select-trigger-height)] w-full"
)} )}
> >
{children} {children}

View File

@@ -352,10 +352,10 @@ export const TimerPage = () => {
} }
}} }}
> >
<SelectTrigger className="h-9 w-[180px] text-xs"> <SelectTrigger className="h-9 w-[180px] flex-shrink-0 text-xs">
<SelectValue /> <SelectValue />
</SelectTrigger> </SelectTrigger>
<SelectContent align="end"> <SelectContent>
{sortOptions.map((option) => ( {sortOptions.map((option) => (
<SelectItem <SelectItem
key={option.value} key={option.value}

View File

@@ -7,8 +7,22 @@ module.exports = {
fog: "#e2e8f0", fog: "#e2e8f0",
mint: "#14b8a6", mint: "#14b8a6",
steel: "#94a3b8" steel: "#94a3b8"
},
keyframes: {
"accordion-down": {
from: { height: "0" },
to: { height: "var(--radix-accordion-content-height)" }
},
"accordion-up": {
from: { height: "var(--radix-accordion-content-height)" },
to: { height: "0" }
}
},
animation: {
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out"
} }
} }
}, },
plugins: [] plugins: [require("tailwindcss-animate")]
}; };

12
pnpm-lock.yaml generated
View File

@@ -144,6 +144,9 @@ importers:
tailwindcss: tailwindcss:
specifier: ^3.4.6 specifier: ^3.4.6
version: 3.4.19 version: 3.4.19
tailwindcss-animate:
specifier: ^1.0.7
version: 1.0.7(tailwindcss@3.4.19)
typescript: typescript:
specifier: ^5.5.3 specifier: ^5.5.3
version: 5.9.3 version: 5.9.3
@@ -2487,6 +2490,11 @@ packages:
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
tailwindcss-animate@1.0.7:
resolution: {integrity: sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==}
peerDependencies:
tailwindcss: '>=3.0.0 || insiders'
tailwindcss@3.4.19: tailwindcss@3.4.19:
resolution: {integrity: sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==} resolution: {integrity: sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==}
engines: {node: '>=14.0.0'} engines: {node: '>=14.0.0'}
@@ -5210,6 +5218,10 @@ snapshots:
supports-preserve-symlinks-flag@1.0.0: {} supports-preserve-symlinks-flag@1.0.0: {}
tailwindcss-animate@1.0.7(tailwindcss@3.4.19):
dependencies:
tailwindcss: 3.4.19
tailwindcss@3.4.19: tailwindcss@3.4.19:
dependencies: dependencies:
'@alloc/quick-lru': 5.2.0 '@alloc/quick-lru': 5.2.0