Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | import { RevokedDelegationIcon } from '../../icons/revoked-delegation-icon'; import { DelegatedIcon } from '@components/icons/delegated-icon'; import { LockedIcon } from '@components/icons/locked'; import { ReceivedArrow } from '@components/icons/received-arrow'; import { SentArrow } from '@components/icons/sent-arrow'; import { Flex, FlexProps, Box, Spinner, FailedIcon, color } from '@stacks/ui'; import { StxTxDirection } from '@utils/get-stx-transfer-direction'; import React, { FC } from 'react'; export type TransactionIconVariants = | StxTxDirection | 'pending' | 'locked' | 'delegated' | 'revoked' | 'failed' | 'default'; function Failed() { return <FailedIcon size="16px" />; } function Pending() { return <Spinner size="xs" color={color('brand')} />; } function Default() { return ( <Box width="16px" height="16px" borderRadius="50%" backgroundColor={color('text-caption')} /> ); } const iconMap: Record<TransactionIconVariants, FC> = { sent: SentArrow, received: ReceivedArrow, locked: LockedIcon, delegated: DelegatedIcon, revoked: RevokedDelegationIcon, failed: Failed, pending: Pending, default: Default, }; function getTxTypeIcon(direction: TransactionIconVariants) { const Icon = iconMap[direction]; return <Icon />; } interface TransactionIconProps extends FlexProps { variant: TransactionIconVariants; } export const TransactionIcon: FC<TransactionIconProps> = ({ variant, ...props }) => { const contents = getTxTypeIcon(variant); return ( <Flex justifyContent="center" alignItems="center" border={`1px solid ${color('border')}`} background={color('bg')} borderRadius="8px" minWidth="48px" minHeight="48px" maxWidth="48px" maxHeight="48px" color={color('brand')} {...props} > {contents} </Flex> ); }; |