mirror of
https://github.com/lux-tel/websites.git
synced 2026-10-30 20:31:36 +00:00
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
'use client';
|
|
|
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
import { Circle } from 'lucide-react';
|
|
|
|
import { type ComponentPropsWithoutRef, type ElementRef, forwardRef } from 'react';
|
|
import { cn } from '../../lib/utils';
|
|
|
|
const RadioGroup = forwardRef<
|
|
ElementRef<typeof RadioGroupPrimitive.Root>,
|
|
ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
|
|
>(({ className, ...props }, ref) => {
|
|
return <RadioGroupPrimitive.Root className={cn('grid gap-2', className)} {...props} ref={ref} />;
|
|
});
|
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
|
|
const RadioGroupItem = forwardRef<
|
|
ElementRef<typeof RadioGroupPrimitive.Item>,
|
|
ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
|
|
>(({ className, ...props }, ref) => {
|
|
return (
|
|
<RadioGroupPrimitive.Item
|
|
ref={ref}
|
|
className={cn(
|
|
'aspect-square h-5 w-5 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50',
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
<Circle className='h-4 w-4 fill-session-green text-current' />
|
|
</RadioGroupPrimitive.Indicator>
|
|
</RadioGroupPrimitive.Item>
|
|
);
|
|
});
|
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
|
|
export { RadioGroup, RadioGroupItem };
|