Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: resolve issue with vertical slider functionality #6299

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions apps/www/registry/default/ui/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ import { cn } from "@/lib/utils"
const Slider = React.forwardRef<
React.ElementRef<typeof SliderPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
>(({ className, ...props }, ref) => (
>(({ className, orientation = "horizontal", ...props }, ref) => (
<SliderPrimitive.Root
ref={ref}
orientation={orientation}
className={cn(
"relative flex w-full touch-none select-none items-center",
"relative flex touch-none select-none items-center",
orientation === "vertical" ? "flex-col h-full w-4" : "w-full h-4",
className
)}
{...props}
>
<SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
<SliderPrimitive.Range className="absolute h-full bg-primary" />
<SliderPrimitive.Track className={cn("relative grow overflow-hidden rounded-full bg-primary/20", orientation === "vertical" ? "h-full w-1.5" : "w-full h-1.5")}>
<SliderPrimitive.Range className={cn("absolute bg-primary", orientation === "vertical" ? "w-full" : "h-full")} />
</SliderPrimitive.Track>
<SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />
<SliderPrimitive.Thumb className="block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" />
</SliderPrimitive.Root>
))
Slider.displayName = SliderPrimitive.Root.displayName
Expand Down
10 changes: 6 additions & 4 deletions apps/www/registry/new-york/ui/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ import { cn } from "@/lib/utils"
const Slider = React.forwardRef<
React.ElementRef<typeof SliderPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
>(({ className, ...props }, ref) => (
>(({ className, orientation = "horizontal", ...props }, ref) => (
<SliderPrimitive.Root
ref={ref}
orientation={orientation}
className={cn(
"relative flex w-full touch-none select-none items-center",
"relative flex touch-none select-none items-center",
orientation === "vertical" ? "flex-col h-full w-4" : "w-full h-4",
className
)}
{...props}
>
<SliderPrimitive.Track className="relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20">
<SliderPrimitive.Range className="absolute h-full bg-primary" />
<SliderPrimitive.Track className={cn("relative grow overflow-hidden rounded-full bg-primary/20", orientation === "vertical" ? "h-full w-1.5" : "w-full h-1.5")}>
<SliderPrimitive.Range className={cn("absolute bg-primary", orientation === "vertical" ? "w-full" : "h-full")} />
</SliderPrimitive.Track>
<SliderPrimitive.Thumb className="block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" />
</SliderPrimitive.Root>
Expand Down