Skip to content

Commit

Permalink
fix: amount text alignment (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishbakh-N authored Aug 15, 2024
1 parent 5735d2c commit 4ea78d2
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {verticalStackCss, Spacing} from 'src/components/widget/theme/spacing';
import {DEFAULT_CURRENCY} from 'src/constants/currency';
import css from 'src/helpers/css';
import {isTouchDevice} from 'src/helpers/isTouchDevice';
import joinClassNames from 'src/helpers/joinClassNames';

const preventDecimal = (
event: JSXInternal.TargetedEvent<HTMLInputElement, KeyboardEvent>
Expand Down Expand Up @@ -60,7 +61,12 @@ const abbreviateNumber = (n: number, significantDigits?: number): string => {
export const DonationAmount = () => {
const inputRef = useRef<HTMLInputElement>(null);

const {primaryColor, addAmounts, amount: fixedAmount} = useConfigContext();
const {
primaryColor,
addAmounts,
amount: fixedAmount,
frequency: fixedFrequency
} = useConfigContext();

const {setDonationAmount, donationAmount, setSubmitError, submitError} =
useWidgetContext();
Expand All @@ -86,7 +92,16 @@ export const DonationAmount = () => {
})}
>
<legend className={legendCss}>Donation amount</legend>
<p className={fixedAmountsCss}>${fixedAmount}</p>
<p
className={joinClassNames([
fixedAmountsCss,
css({
textAlign: fixedFrequency ? 'left' : 'center'
})
])}
>
${fixedAmount}
</p>
</fieldset>
);
}
Expand Down

0 comments on commit 4ea78d2

Please sign in to comment.