diff --git a/src/assets/icons/COPYING.md b/src/assets/icons/COPYING.md index 811c33b12..7cb81d6d9 100644 --- a/src/assets/icons/COPYING.md +++ b/src/assets/icons/COPYING.md @@ -1,3 +1,8 @@ # Custom icons +- blue-chest.png - Generated by Midjourney for Soapbox. CC0 +- coin-chest.png - Generated by Midjourney for Soapbox. CC0 +- coin.png - Generated by Midjourney for Soapbox. CC0 +- money-bag.png - Generated by Midjourney for Soapbox. CC0 +- pile-coin.png - Generated by Midjourney for Soapbox. CC0 - verified.svg - Created by Alex Gleason. CC0 diff --git a/src/assets/icons/blue-chest.png b/src/assets/icons/blue-chest.png new file mode 100644 index 000000000..b05558045 Binary files /dev/null and b/src/assets/icons/blue-chest.png differ diff --git a/src/assets/icons/coin-stack.png b/src/assets/icons/coin-stack.png new file mode 100644 index 000000000..06a16894a Binary files /dev/null and b/src/assets/icons/coin-stack.png differ diff --git a/src/assets/icons/coin.png b/src/assets/icons/coin.png new file mode 100644 index 000000000..e116e7367 Binary files /dev/null and b/src/assets/icons/coin.png differ diff --git a/src/assets/icons/money-bag.png b/src/assets/icons/money-bag.png new file mode 100644 index 000000000..d33f018c4 Binary files /dev/null and b/src/assets/icons/money-bag.png differ diff --git a/src/assets/icons/pile-coin.png b/src/assets/icons/pile-coin.png new file mode 100644 index 000000000..72dc7ee18 Binary files /dev/null and b/src/assets/icons/pile-coin.png differ diff --git a/src/components/ui/button/button.tsx b/src/components/ui/button/button.tsx index 412717d3c..1c9e7d5a1 100644 --- a/src/components/ui/button/button.tsx +++ b/src/components/ui/button/button.tsx @@ -17,6 +17,8 @@ interface IButton { className?: string; /** Prevent the button from being clicked. */ disabled?: boolean; + /** Specifies the icon element as 'svg' or 'img'. */ + iconElement?: 'svg' | 'img'; /** URL to an SVG icon to render inside the button. */ icon?: string; /** Action when the button is clicked. */ @@ -39,6 +41,7 @@ const Button = React.forwardRef((props, ref): JSX.El block = false, children, disabled = false, + iconElement, icon, onClick, size = 'md', @@ -63,7 +66,7 @@ const Button = React.forwardRef((props, ref): JSX.El return null; } - return ; + return ; }; const handleClick: React.MouseEventHandler = React.useCallback((event) => { diff --git a/src/components/ui/icon/icon.tsx b/src/components/ui/icon/icon.tsx index 688b4dca6..eaa4e9f0a 100644 --- a/src/components/ui/icon/icon.tsx +++ b/src/components/ui/icon/icon.tsx @@ -17,24 +17,28 @@ interface IIcon extends Pick, 'strokeWidth'> { src: string; /** Width and height of the icon in pixels. */ size?: number; + /** Specifies the media element type as 'svg' or 'img'. */ + element?: 'svg' | 'img'; /** Override the data-testid */ 'data-testid'?: string; } -/** Renders and SVG icon with optional counter. */ -const Icon: React.FC = ({ src, alt, count, size, countMax, ...filteredProps }): JSX.Element => ( -
- {count ? ( - - - - ) : null} +/** Renders an SVG or image icon with optional counter. */ +const Icon: React.FC = ({ src, alt, count, size, countMax, element = 'svg', ...filteredProps }): JSX.Element => { + return ( +
+ {count ? ( + + + + ) : null} + {element === 'svg' ? () : ({alt}) } - -
-); +
+ ); +}; export default Icon; diff --git a/src/features/zap/components/zap-pay-request-form.tsx b/src/features/zap/components/zap-pay-request-form.tsx index 5ce820b67..723c1fa64 100644 --- a/src/features/zap/components/zap-pay-request-form.tsx +++ b/src/features/zap/components/zap-pay-request-form.tsx @@ -3,6 +3,11 @@ import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import { zap } from 'soapbox/actions/interactions'; import { openModal, closeModal } from 'soapbox/actions/modals'; +import chestIcon from 'soapbox/assets/icons/blue-chest.png'; +import coinStack from 'soapbox/assets/icons/coin-stack.png'; +import coinIcon from 'soapbox/assets/icons/coin.png'; +import moneyBag from 'soapbox/assets/icons/money-bag.png'; +import pileCoin from 'soapbox/assets/icons/pile-coin.png'; import Account from 'soapbox/components/account'; import { Stack, Button, Input } from 'soapbox/components/ui'; import { useAppDispatch } from 'soapbox/hooks'; @@ -66,11 +71,11 @@ const ZapPayRequestForm = ({ account, status }: IZapPayRequestForm) => {
-