Skip to content

Commit

Permalink
Add custom currencyselector label
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNeshi committed Dec 21, 2023
1 parent 80c6ead commit ef469a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/components/BankDetails/BankDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function Content({
onChange={setTargetCurrency}
classes={{ combobox: "w-full md:w-80" }}
disabled={isSubmitting}
label="Select your bank account currency:"
/>
<ExpectedFunds
classes={{ input: "md:w-80" }}
Expand Down
5 changes: 3 additions & 2 deletions src/components/CurrencySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ export type Currency = {

type Props = {
classes?: { combobox?: string };
currencies: Currency[];
disabled: boolean;
label: string;
value: Currency;
currencies: Currency[];
onChange: (currency: Currency) => void;
};

Expand Down Expand Up @@ -44,7 +45,7 @@ function CurrencySelector(props: Props) {
return (
<div className="field">
<Label htmlFor={inputRef.current?.id} required aria-required>
Select your bank account currency:
{props.label}
</Label>
<Combobox
value={props.value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ export default function CurrencySelectorField<T extends FieldValues>(

return (
<CurrencySelector
value={field.value}
onChange={field.onChange}
classes={props.classes}
currencies={props.currencies.map((x) => ({ code: x.toUpperCase() }))}
disabled={!!props.disabled || formState.isSubmitting}
label="Select your donation currency:"
onChange={field.onChange}
value={field.value}
/>
);
}

0 comments on commit ef469a0

Please sign in to comment.