fix(webui): share control layout for preset alignment

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-10 01:33:02 +08:00
1 parent 55ff1d8d1f
commit 763ae9c2ae
7 files changed
+49 -18

No files matched your search

+1
View File
@@ -23,6 +23,7 @@ const buttonVariants = cva(
size: {
default: "h-10 px-4 py-2",
sm: "h-9 px-3",
control: "control-layout",
lg: "h-11 px-8",
icon: "h-9 w-9",
},
@@ -0,0 +1,16 @@
import { ChevronDown } from "lucide-react";
import { cn } from "@/lib/utils";
export function ControlChevron({ className }: { className?: string }) {
return (
<ChevronDown
// Keep the horizontal viewBox around the artwork, including its stroke.
viewBox="5 0 14 24"
width={14}
height={24}
className={cn("h-3.5 w-auto shrink-0 text-muted-foreground", className)}
aria-hidden
/>
);
}
+3 -2
View File
@@ -5,6 +5,7 @@ import { Check, ChevronDown, ChevronUp } from "lucide-react";
import { floatingSurfaceElevationClassName, floatingItemClassName } from "@/components/ui/floating-surface";
import { useFloatingPortal } from "@/components/ui/floating-portal";
import { cn } from "@/lib/utils";
import { ControlChevron } from "@/components/ui/control-chevron";
export const Select = SelectPrimitive.Root;
export const SelectValue = SelectPrimitive.Value;
@@ -14,9 +15,9 @@ export const SelectTrigger = React.forwardRef<
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Trigger ref={ref} {...props}
className={cn("flex h-9 items-center justify-between gap-2 rounded-control border border-input bg-background px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 [&>span:first-child]:truncate", className)}>
className={cn("control-layout justify-between rounded-control border-input bg-background text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 [&>span:first-child]:truncate", className)}>
{children}
<SelectPrimitive.Icon asChild><ChevronDown className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden /></SelectPrimitive.Icon>
<SelectPrimitive.Icon><ControlChevron /></SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
));
SelectTrigger.displayName = "SelectTrigger";