Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: icons to use variants default and small, closes #4950 #4957

Merged
merged 3 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/app/components/account/account-list-item.layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export function AccountListItemLayout(props: AccountListItemLayoutProps) {
color="accent.text-subdued"
position="absolute"
right={0}
size="18px"
top="calc(50% - 8px)"
/>
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/available-balance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function AvailableBalance(props: { balance: Money; balanceTooltipLabel?:
</styled.span>
<BasicTooltip label={balanceTooltipLabel} side="top">
<Box>
<InfoCircleIcon color="accent.text-subdued" width="xs" />
<InfoCircleIcon color="accent.text-subdued" variant="small" />
</Box>
</BasicTooltip>
</HStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { ArrowUpIcon } from '@app/ui/icons/arrow-up-icon';

function TxStatusIcon(props: { address: string; tx: BitcoinTx }) {
const { address, tx } = props;
if (isBitcoinTxInbound(address, tx)) return <ArrowDownIcon width="xs" />;
return <ArrowUpIcon width="xs" />;
if (isBitcoinTxInbound(address, tx)) return <ArrowDownIcon variant="small" />;
return <ArrowUpIcon variant="small" />;
}

interface TransactionIconProps extends CircleProps {
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/fees-row/components/fee-estimate-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function FeeEstimateItem({
}: FeeEstimateItemProps) {
const selectedIcon = useMemo(() => {
const isSelected = index === selectedItem;
return isSelected ? <CheckmarkIcon /> : <></>;
return isSelected ? <CheckmarkIcon variant="small" /> : <></>;
}, [index, selectedItem]);

return (
Expand All @@ -47,7 +47,7 @@ export function FeeEstimateItem({
>
<HStack gap="space.01">
<styled.span textStyle="label.02">{labels[index]}</styled.span>
{!disableFeeSelection && (isVisible ? selectedIcon : <ChevronDownIcon />)}
{!disableFeeSelection && (isVisible ? selectedIcon : <ChevronDownIcon variant="small" />)}
</HStack>
</Link>
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/fees-row/components/fees-row.layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function FeesRowLayout(props: FeesRowLayoutProps) {
<InfoCircleIcon
color="accent.text-subdued"
onClick={() => openInNewTab(url)}
width="xs"
variant="small"
/>
</HStack>
</BasicTooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export function IncreaseFeeButton(props: IncreaseFeeButtonProps) {
type="button"
zIndex={999}
>
<HStack gap="space.00">
<ChevronsRightIcon color="stacks" mr="3px" />
<HStack gap="space.01">
<ChevronsRightIcon color="stacks" variant="small" />
<styled.span textStyle="label.03">Increase fee</styled.span>
</HStack>
</styled.button>
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/transaction/token-transfer-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function TokenTransferIcon(props: { tx: StacksTx }) {
const currentAccountStxAddress = useCurrentAccountStxAddressState();
const isSent = tx.sender_address === currentAccountStxAddress;

if (isSent) return <ArrowUpIcon width="xs" />;
if (isSent) return <ArrowUpIcon variant="small" />;

return <ArrowDownIcon width="xs" />;
return <ArrowDownIcon variant="small" />;
}
4 changes: 2 additions & 2 deletions src/app/components/transaction/transaction-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export function TransactionIcon(props: { tx: StacksTx }) {

switch (tx.tx_type) {
case 'coinbase':
return <PlusIcon width="xs" />;
return <PlusIcon variant="small" />;
case 'smart_contract':
return <CodeIcon width="xs" />;
return <CodeIcon variant="small" />;
case 'token_transfer':
return <TokenTransferIcon tx={tx} />;
case 'contract_call':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function FtTransferItem({ ftTransfer, parentTx }: FtTransferItemProps) {
assetMetadata.image_canonical_uri &&
assetMetadata.name &&
getImageCanonicalUri(assetMetadata.image_canonical_uri, assetMetadata.name);
const icon = isOriginator ? <ArrowUpIcon width="xs" /> : <ArrowDownIcon width="xs" />;
const icon = isOriginator ? <ArrowUpIcon variant="small" /> : <ArrowDownIcon variant="small" />;
const title = `${assetMetadata.name || 'Token'} Transfer`;
const value = `${isOriginator ? '-' : ''}${displayAmount.toFormat()}`;
const transferIcon = ftImageCanonicalUri ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function StxTransferItem({ stxTransfer, parentTx }: StxTransferItemProps)
const isOriginator = stxTransfer.sender === currentAccount?.address;

const caption = getTxCaption(parentTx.tx) ?? '';
const icon = isOriginator ? <ArrowUpIcon width="xs" /> : <ArrowDownIcon width="xs" />;
const icon = isOriginator ? <ArrowUpIcon variant="small" /> : <ArrowDownIcon variant="small" />;
const title = 'Stacks Token Transfer';
const value = `${isOriginator ? '-' : ''}${stacksValue({
value: stxTransfer.amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { token } from 'leather-styles/tokens';

import { LoadingSpinner } from '@app/components/loading-spinner';
import { Spinner } from '@app/ui/components/spinner';
import { ReloadIcon } from '@app/ui/icons/reload-icon';
import { RefreshIcon } from '@app/ui/icons/refresh-icon';

interface CollectiblesLayoutProps {
title: string;
Expand All @@ -27,9 +27,9 @@ export function CollectiblesLayout({
<HStack columnGap="space.02">
<styled.span textStyle="label.01">{title}</styled.span>
{isLoading ? (
<Spinner color={token('colors.accent.text-primary')} opacity={0.5} size="16px" />
<Spinner color={token('colors.accent.text-primary')} opacity={0.5} />
) : (
<ReloadIcon cursor="pointer" onClick={() => onRefresh()} />
<RefreshIcon cursor="pointer" onClick={() => onRefresh()} variant="small" />
)}
</HStack>
{subHeader}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CollectiblePlaceholderLayout } from './_collectible-types/collectible-p
export function ImageUnavailable() {
return (
<CollectiblePlaceholderLayout>
<EyeSlashIcon width="md" />
<EyeSlashIcon />
<styled.span pt="space.02" px="space.04" textStyle="label.03">
Image currently unavailable
</styled.span>
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/feedback-button/feedback-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function FeedbackButton() {
onClick={openFeedbackDialog}
>
<Flex>
<MegaphoneIcon mr="space.01" mt="2px" />
<MegaphoneIcon mr="space.01" mt="2px" variant="small" />
Give feedback
</Flex>
</Button>
Expand Down
5 changes: 2 additions & 3 deletions src/app/features/ledger/components/ledger-screen-detail.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Flex, styled } from 'leather-styles/jsx';
import { token } from 'leather-styles/tokens';

import { BasicTooltip } from '@app/ui/components/tooltip/basic-tooltip';
import { Caption } from '@app/ui/components/typography/caption';
Expand All @@ -21,10 +20,10 @@ export function LedgerScreenDetail(props: LedgerScreenDetailProps) {
<Flex cursor="question" display="inline-flex">
{title}
<InfoCircleIcon
color="accent.text-subdued"
ml="space.01"
mt="space.01"
width="xs"
style={{ color: token('colors.accent.text-subdued') }}
variant="small"
/>
</Flex>
</BasicTooltip>
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/message-signer/hash-drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface ShowHashButtonProps {
}
function ShowHashButton(props: ShowHashButtonProps) {
const { expanded } = props;
return expanded ? <ChevronUpIcon /> : <ChevronDownIcon />;
return expanded ? <ChevronUpIcon variant="small" /> : <ChevronDownIcon variant="small" />;
}

interface HashDrawerProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export function PsbtRequestDetailsHeader() {
>
<Box width="12px">
{isPsbtMutable ? (
<UnlockIcon style={{ color: tokenLabelColor }} width="xs" />
<UnlockIcon style={{ color: tokenLabelColor }} variant="small" />
) : (
<LockIcon style={{ color: tokenLabelColor }} width="xs" />
<LockIcon style={{ color: tokenLabelColor }} variant="small" />
)}
</Box>
<styled.span
Expand Down
3 changes: 1 addition & 2 deletions src/app/pages/fund/components/fast-checkout-badge.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { HStack, styled } from 'leather-styles/jsx';
import { token } from 'leather-styles/tokens';

import { ZapIcon } from '@app/ui/icons/zap-icon';

Expand All @@ -15,7 +14,7 @@ export function FastCheckoutBadge() {
paddingY="space.01"
gap="space.01"
>
<ZapIcon style={{ color: token('colors.success.label') }} width="xs" />
<ZapIcon color="success.label" variant="small" />
<styled.span color="success.label" textStyle="caption.02">
Fast checkout
</styled.span>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/fund/components/zero-percent-fees-badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function ZeroPercentFeesBadge() {
paddingY="space.01"
gap="space.01"
>
<StarIcon color="warning.label" width="xs" />
<StarIcon color="warning.label" variant="small" />
<styled.span color="warning.label" textStyle="caption.02">
0 % Fees
</styled.span>
Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/home/components/account-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export function AccountActions(props: FlexProps) {
<SendButton />
<ActionButton
data-testid={HomePageSelectors.ReceiveCryptoAssetBtn}
icon={<InboxIcon width="md" />}
icon={<InboxIcon />}
label="Receive"
onClick={() => navigate(receivePath, { state: { backgroundLocation: location } })}
/>

{(!!stacksAccount || !!btcAccount) && (
<ActionButton
data-testid={HomePageSelectors.FundAccountBtn}
icon={<CreditCardIcon width="md" />}
icon={<CreditCardIcon />}
label="Buy"
onClick={() => navigate(RouteUrls.FundChooseCurrency)}
/>
Expand All @@ -51,7 +51,7 @@ export function AccountActions(props: FlexProps) {
[ChainID.Mainnet]: (
<ActionButton
data-testid={HomePageSelectors.SwapBtn}
icon={<SwapIcon width="md" />}
icon={<SwapIcon />}
label="Swap"
onClick={() => navigate(RouteUrls.Swap)}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/home/components/account-info-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function AccountInfoCard() {
{name}
</styled.p>
<Box mt="space.01" ml="space.02">
<ChevronDownIcon />
<ChevronDownIcon variant="small" />
</Box>
</Flex>
</Link>
Expand Down
6 changes: 2 additions & 4 deletions src/app/pages/home/components/send-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function SendButtonSuspense() {
<ActionButton
data-testid={HomePageSelectors.SendCryptoAssetBtn}
label="Send"
icon={<SendIcon width="md" />}
icon={<SendIcon />}
onClick={() =>
whenWallet({
ledger: () =>
Expand All @@ -45,9 +45,7 @@ function SendButtonSuspense() {
);
}

const SendButtonFallback = memo(() => (
<ActionButton label="Send" icon={<SendIcon width="md" />} disabled />
));
const SendButtonFallback = memo(() => <ActionButton label="Send" icon={<SendIcon />} disabled />);

export function SendButton() {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function RecipientDropdownItem({
>
<HStack gap="space.01">
<styled.span textStyle="label.02">{labels[index]}</styled.span>
{isVisible ? <></> : <ChevronDownIcon />}
{isVisible ? <></> : <ChevronDownIcon variant="small" />}
</HStack>
</styled.button>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function SelectAssetTriggerButton({
<HStack>
{icon && <styled.img src={icon} width="32px" height="32px" alt="Swap asset" />}
<styled.span textStyle="label.01">{symbol}</styled.span>
<ChevronDownIcon />
<ChevronDownIcon variant="small" />
</HStack>
</Button>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function RouteNames(props: { swapSubmissionData: SwapSubmissionData }) {
return (
<HStack gap="space.01" key={route.name}>
<styled.span>{route.name}</styled.span>
{insertIcon && <ChevronUpIcon transform="rotate(90deg)" />}
{insertIcon && <ChevronUpIcon transform="rotate(90deg)" variant="small" />}
</HStack>
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/swap/components/swap-toggle-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function SwapToggleButton() {
onClick={onToggleSwapAssets}
type="button"
>
<SwapIcon transform="rotate(90deg)" />
<SwapIcon transform="rotate(90deg)" variant="small" />
</styled.button>
);
}
2 changes: 1 addition & 1 deletion src/app/ui/components/button/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const WithToken: Story = {
<HStack>
<BtcIcon />
<styled.span textStyle="label.01">Button</styled.span>
<ChevronDownIcon />
<ChevronDownIcon variant="small" />
</HStack>
),
trigger: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const DropdownMenu: Story = {
<styled.button>
<HStack gap="space.02" width="100%">
<styled.span textStyle="label.02">Options</styled.span>
<ChevronDownIcon />
<ChevronDownIcon variant="small" />
</HStack>
</styled.button>
</Component.Trigger>
Expand Down
6 changes: 4 additions & 2 deletions src/app/ui/components/item/item.layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function ItemLayout({
{titleLeft}
</styled.span>
)}
{isSelected && <CheckmarkIcon />}
{isSelected && <CheckmarkIcon variant="small" />}
</HStack>
{isValidElement(captionLeft) ? (
captionLeft
Expand All @@ -72,7 +72,9 @@ export function ItemLayout({
</styled.span>
)}
</Stack>
{showChevron && <ChevronUpIcon color={itemChevronStyles} transform="rotate(90deg)" />}
{showChevron && (
<ChevronUpIcon color={itemChevronStyles} transform="rotate(90deg)" variant="small" />
)}
</HStack>
</Flex>
</Flag>
Expand Down
11 changes: 6 additions & 5 deletions src/app/ui/components/select/select.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { Meta, StoryObj } from '@storybook/react';
import { HStack, styled } from 'leather-styles/jsx';

import { CheckmarkIcon } from '../../icons/checkmark-icon';
import { ChevronDownIcon } from '../../icons/chevron-down-icon';
import { PlaceholderIcon } from '../../icons/placeholder-icon';
import { CheckmarkIcon } from '@app/ui/icons/checkmark-icon';
import { ChevronDownIcon } from '@app/ui/icons/chevron-down-icon';
import { PlaceholderIcon } from '@app/ui/icons/placeholder-icon';

import { Select as Component, SelectItem } from './select';
import { SelectItemLayout } from './select-item.layout';

Expand All @@ -24,7 +25,7 @@ export const Select: Story = {
<Component.Trigger>
<Component.Value placeholder="Options" />
<Component.Icon>
<ChevronDownIcon />
<ChevronDownIcon variant="small" />
</Component.Icon>
</Component.Trigger>
<Component.Portal>
Expand All @@ -42,7 +43,7 @@ export const Select: Story = {
<styled.span textStyle="label.02">{item.label}</styled.span>
</Component.ItemText>
<Component.ItemIndicator>
<CheckmarkIcon />
<CheckmarkIcon variant="small" />
</Component.ItemIndicator>
</HStack>
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/components/spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface SpinnerProps extends SquareProps {

export function Spinner({
emptyColor = 'transparent',
size = '1.5rem',
size = 'sm',
label = 'Loading...',
thickness = '2px',
speed = '0.85s',
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/components/tooltip/tooltip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Tooltip: Story = {
<RadixTooltip.Provider delayDuration={300}>
<Component {...args}>
<Box>
<InfoCircleIcon color="accent.text-subdued" width="xs" />
<InfoCircleIcon color="accent.text-subdued" variant="small" />
</Box>
</Component>
</RadixTooltip.Provider>
Expand Down
Loading
Loading