Skip to content

Commit

Permalink
select (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
jojo-stripe authored Jun 21, 2024
1 parent 454c4fe commit 69e7eaf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion app/components/testdata/CreatePaymentsButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,21 @@ export default function CreatePaymentsButton({classes}: {classes?: string}) {
<FormItem>
<FormLabel>Number of payments</FormLabel>
<FormControl>
<Input {...field} type="number" min="1" step={1} />
<Select
{...field}
onValueChange={(value) => field.onChange(value)}
>
<SelectTrigger className="mt-1">
<SelectValue>{field.value}</SelectValue>
</SelectTrigger>
<SelectContent>
{Array.from({length: 10}, (_, i) => (
<SelectItem key={i + 1} value={String(i + 1)}>
{i + 1}
</SelectItem>
))}
</SelectContent>
</Select>
</FormControl>
<FormMessage />
</FormItem>
Expand Down
2 changes: 1 addition & 1 deletion components/ui/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const SelectContent = React.forwardRef<
<SelectPrimitive.Content
ref={ref}
className={cn(
'text-popover-foreground relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-background text-primary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
'text-popover-foreground relative z-[60] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-background text-primary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
position === 'popper' &&
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
className
Expand Down

0 comments on commit 69e7eaf

Please sign in to comment.