feat: complete settings sync, standard UI inputs, prescriptions flow, pet profile and checkout enhancements
Deploy Canina / deploy (push) Failing after 51s
Deploy Canina / deploy (push) Failing after 51s
This commit is contained in:
1 parent
b3c60a1a7d
commit
6df92f03d7
32 files changed
+61750
-59151
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import React, { forwardRef } from 'react';
|
||||
import { ChevronDown } from 'lucide-react';
|
||||
|
||||
export interface SelectOption {
|
||||
value: string | number;
|
||||
label: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
||||
options?: SelectOption[];
|
||||
error?: string;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
||||
({ className = '', error, options, children, disabled, ...props }, ref) => {
|
||||
return (
|
||||
<div className="w-full relative font-vazir">
|
||||
<select
|
||||
ref={ref}
|
||||
disabled={disabled}
|
||||
className={`w-full bg-white border font-vazir text-sm transition-all duration-200 outline-none appearance-none pr-4 pl-10 py-2.5 rounded-xl shadow-xs cursor-pointer
|
||||
${error ? 'border-red-400 focus:border-red-500 focus:ring-2 focus:ring-red-500/20' : 'border-gray-200 focus:border-purple-500 focus:ring-2 focus:ring-purple-500/20'}
|
||||
${disabled ? 'bg-gray-50 text-gray-400 cursor-not-allowed border-gray-200' : 'text-gray-900 hover:border-gray-300'}
|
||||
${className}`}
|
||||
{...props}
|
||||
>
|
||||
{options
|
||||
? options.map((opt) => (
|
||||
<option key={opt.value} value={opt.value} disabled={opt.disabled}>
|
||||
{opt.label}
|
||||
</option>
|
||||
))
|
||||
: children}
|
||||
</select>
|
||||
<div className="absolute left-3.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none">
|
||||
<ChevronDown className="w-4 h-4" />
|
||||
</div>
|
||||
{error && (
|
||||
<p className="mt-1 text-xs text-red-500 font-medium flex items-center gap-1 animate-in fade-in duration-200">
|
||||
<span>•</span>
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
Select.displayName = 'Select';
|
||||
export default Select;
|
||||
Reference in new issue
Block a user