diff --git a/src/features/zap/components/zap-button/zap-button.tsx b/src/features/zap/components/zap-button/zap-button.tsx index 62fdccad4..a17732f77 100644 --- a/src/features/zap/components/zap-button/zap-button.tsx +++ b/src/features/zap/components/zap-button/zap-button.tsx @@ -1,48 +1,64 @@ import clsx from 'clsx'; import React from 'react'; +import { Link } from 'react-router-dom'; -import { themes } from './useZapButtonStyles'; +import { shortNumberFormat } from 'soapbox/utils/numbers'; -interface IZapButton { +interface IButton { + /** Whether this button expands the width of its container. */ + block?: boolean; + /** Elements inside the ); + if (to) { + return ( + + {renderButton()} + + ); + } + return renderButton(); }); diff --git a/src/features/zap/components/zap-pay-request-form.tsx b/src/features/zap/components/zap-pay-request-form.tsx index aa19dfea9..d39afe24d 100644 --- a/src/features/zap/components/zap-pay-request-form.tsx +++ b/src/features/zap/components/zap-pay-request-form.tsx @@ -37,6 +37,9 @@ const ZapPayRequestForm = ({ account, status, onClose }: IZapPayRequestForm) => const [zapComment, setZapComment] = useState(''); // amount in millisatoshi const [zapAmount, setZapAmount] = useState(50); + const ZAP_AMOUNTS = [50, 200, 1_000, 3_000, 5_000]; + const ZAP_ICONS = [coinIcon, coinStack, pileCoin, moneyBag, chestIcon]; + const handleSubmit = async (e?: React.FormEvent) => { e?.preventDefault(); @@ -81,11 +84,7 @@ const ZapPayRequestForm = ({ account, status, onClose }: IZapPayRequestForm) =>
- setZapAmount(50)} className='m-1' theme={zapAmount === 50 ? 'primary' : 'muted'} icon={coinIcon} text='50' /> - setZapAmount(200)} className='m-1' theme={zapAmount === 200 ? 'primary' : 'muted'} icon={coinStack} text='200' /> - setZapAmount(1_000)} className='m-1' theme={zapAmount === 1_000 ? 'primary' : 'muted'} icon={pileCoin} text='1K' /> - setZapAmount(3_000)} className='m-1' theme={zapAmount === 3_000 ? 'primary' : 'muted'} icon={moneyBag} text='3K' /> - setZapAmount(5_000)} className='m-1' theme={zapAmount === 5_000 ? 'primary' : 'muted'} icon={chestIcon} text='5K' /> + {ZAP_AMOUNTS.map((amount, i) => setZapAmount(amount)} className='m-0.5 sm:m-1' selected={zapAmount === amount} icon={ZAP_ICONS[i]} amount={amount} />)}