From 97bee75e398784cb3e51a67e8c41d8e9494f5654 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Sat, 18 Oct 2025 15:08:49 +0530 Subject: [PATCH] feat(select): add loading spinner --- src/components/ui/Select.tsx | 62 ++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/src/components/ui/Select.tsx b/src/components/ui/Select.tsx index 8402149..f8d7c30 100644 --- a/src/components/ui/Select.tsx +++ b/src/components/ui/Select.tsx @@ -1,28 +1,50 @@ import { cn } from '@/lib/utils'; -import { SelectHTMLAttributes } from 'react'; +import { Loader2, ChevronDown } from 'lucide-react'; +import { SelectHTMLAttributes, forwardRef } from 'react'; interface SelectProps extends SelectHTMLAttributes { options: { value: string; label: string; disabled?: boolean }[]; + loading?: boolean; } -export const Select = ({ className, options, ...restProps }: SelectProps) => { - return ( - - ); -}; +export const Select = forwardRef( + ({ className, options, loading = false, disabled, ...restProps }, ref) => { + return ( +
+ + + {loading ? ( + + ) : ( + + )} + +
+ ); + }, +); + +Select.displayName = 'Select'; export default Select;