Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
omeralpi committed Apr 13, 2024
1 parent 95148b9 commit 2dce4d6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
2 changes: 1 addition & 1 deletion components/ui/phone-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const CountrySelect = ({ disabled, value, onChange, options }: CountrySelectProp
<PopoverContent className="p-0 w-[300px]">
<Command>
<CommandList>
<ScrollArea className="h-72 w-full rounded-md">
<ScrollArea className="h-72">
<CommandInput placeholder="Search country..." />
<CommandEmpty>No country found.</CommandEmpty>
<CommandGroup>
Expand Down
55 changes: 29 additions & 26 deletions content/snippets/phone-input.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
} from "@/components/ui/popover";

import { cn } from "@/lib/utils";
import { ScrollArea } from "./scroll-area";

type PhoneInputProps = Omit<
React.InputHTMLAttributes<HTMLInputElement>,
Expand Down Expand Up @@ -120,33 +121,35 @@ const CountrySelect = ({
<CommandList>
<CommandInput placeholder="Search country..." />
<CommandEmpty>No country found.</CommandEmpty>
<CommandGroup>
{options
.filter((x) => x.value)
.map((option) => (
<CommandItem
className="gap-2"
key={option.value}
onSelect={() => handleSelect(option.value)}>
<FlagComponent
country={option.value}
countryName={option.label}
/>
<span className="text-sm flex-1">{option.label}</span>
{option.value && (
<span className="text-sm text-foreground/50">
{`+${RPNInput.getCountryCallingCode(option.value)}`}
</span>
)}
<CheckIcon
className={cn(
"ml-auto h-4 w-4",
option.value === value ? "opacity-100" : "opacity-0",
<ScrollArea className="h-72">
<CommandGroup>
{options
.filter((x) => x.value)
.map((option) => (
<CommandItem
className="gap-2"
key={option.value}
onSelect={() => handleSelect(option.value)}>
<FlagComponent
country={option.value}
countryName={option.label}
/>
<span className="text-sm flex-1">{option.label}</span>
{option.value && (
<span className="text-sm text-foreground/50">
{`+${RPNInput.getCountryCallingCode(option.value)}`}
</span>
)}
/>
</CommandItem>
))}
</CommandGroup>
<CheckIcon
className={cn(
"ml-auto h-4 w-4",
option.value === value ? "opacity-100" : "opacity-0",
)}
/>
</CommandItem>
))}
</CommandGroup>
</ScrollArea>
</CommandList>
</Command>
</PopoverContent>
Expand Down

0 comments on commit 2dce4d6

Please sign in to comment.