refactor: restyle input with sm, md and lg sizes

This commit is contained in:
rajun 2026-10-27 16:28:50 +05:30
parent fd36cf889a
commit cba840a66f

View File

@ -1,21 +1,25 @@
import * as React from 'react'; import type { ComponentProps } from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '~/lib/utils'; import { cn } from '~/lib/utils';
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>( const inputVariants = cva(
({ className, type, ...props }, ref) => { 'flex w-full rounded-control border border-border-control bg-background text-text-primary transition-[color,border-color,box-shadow] duration-150 focus-visible:border-primary focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-danger/70',
return ( {
<input variants: {
type={type} size: {
className={cn( sm: 'h-8 px-2.5 text-xs',
'flex h-10 w-full rounded-xl border border-neutral-800 bg-[#181818] px-4 py-3 text-sm text-white placeholder-neutral-600 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-white focus-visible:outline-none focus-visible:border-orange-500 disabled:cursor-not-allowed disabled:opacity-50 transition-colors duration-200', md: 'h-10 px-3 text-base',
className // Login: taller, with a soft focus ring
)} lg: 'h-12 rounded-field border-border-dialog bg-surface px-3.5 text-base focus-visible:ring-3 focus-visible:ring-primary/15',
ref={ref} },
{...props} mono: { true: 'font-mono', false: '' },
/> },
); defaultVariants: { size: 'md', mono: false },
} },
); );
Input.displayName = 'Input';
export { Input }; export interface InputProps extends Omit<ComponentProps<'input'>, 'size'>, VariantProps<typeof inputVariants> {}
export function Input({ className, size, mono, ...props }: InputProps) {
return <input className={cn(inputVariants({ size, mono }), className)} {...props} />;
}