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: Box flex -> Stack #4629

Closed
wants to merge 5 commits into from
Closed
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
6 changes: 3 additions & 3 deletions src/components/balances/AssetsTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CheckBalance from '@/features/counterfactual/CheckBalance'
import { type ReactElement } from 'react'
import { Box, IconButton, Checkbox, Skeleton, SvgIcon, Tooltip, Typography } from '@mui/material'
import { Stack, IconButton, Checkbox, Skeleton, SvgIcon, Tooltip, Typography } from '@mui/material'
import type { TokenInfo } from '@safe-global/safe-gateway-typescript-sdk'
import { TokenType } from '@safe-global/safe-gateway-typescript-sdk'
import css from './styles.module.css'
Expand Down Expand Up @@ -185,7 +185,7 @@ const AssetsTable = ({
sticky: true,
collapsed: item.tokenInfo.address === hidingAsset,
content: (
<Box display="flex" flexDirection="row" gap={1} alignItems="center">
<Stack direction="row" spacing={1} alignItems="center">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it didn't work here for some reason it keeps using Box.
Screenshot 2024-12-09 at 16 27 58

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a couple other places. Will close the PR, not worth the trouble.

<>
<SendButton tokenInfo={item.tokenInfo} />

Expand All @@ -209,7 +209,7 @@ const AssetsTable = ({
</Track>
)}
</>
</Box>
</Stack>
),
},
},
Expand Down
6 changes: 3 additions & 3 deletions src/components/balances/TokenListSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useAppDispatch, useAppSelector } from '@/store'
import { selectSettings, setTokenList, TOKEN_LISTS } from '@/store/settingsSlice'
import { FEATURES } from '@/utils/chains'
import type { SelectChangeEvent } from '@mui/material'
import { Box, SvgIcon, Tooltip, Typography, FormControl, InputLabel, Select, MenuItem } from '@mui/material'
import { Stack, SvgIcon, Tooltip, Typography, FormControl, InputLabel, Select, MenuItem } from '@mui/material'
import InfoIcon from '@/public/images/notifications/info.svg'
import ExternalLink from '@/components/common/ExternalLink'
import { OnboardingTooltip } from '@/components/common/OnboardingTooltip'
Expand Down Expand Up @@ -58,7 +58,7 @@ const TokenListSelect = () => {
>
<MenuItem value={TOKEN_LISTS.TRUSTED}>
<Track {...ASSETS_EVENTS.SHOW_DEFAULT_TOKENS}>
<Box display="flex" flexDirection="row" gap="4px" alignItems="center" minWidth={155}>
<Stack direction="row" spacing="4px" alignItems="center" minWidth={155}>
{TokenListLabel.TRUSTED}
<Tooltip
arrow
Expand All @@ -72,7 +72,7 @@ const TokenListSelect = () => {
<SvgIcon sx={{ display: 'block' }} color="border" fontSize="small" component={InfoIcon} />
</span>
</Tooltip>
</Box>
</Stack>
</Track>
</MenuItem>

Expand Down
6 changes: 3 additions & 3 deletions src/components/balances/TokenMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Sticky } from '@/components/common/Sticky'
import Track from '@/components/common/Track'
import { ASSETS_EVENTS } from '@/services/analytics'
import { VisibilityOffOutlined } from '@mui/icons-material'
import { Box, Typography, Button } from '@mui/material'
import { Stack, Typography, Button, Box } from '@mui/material'

import css from './styles.module.css'

Expand Down Expand Up @@ -31,7 +31,7 @@ const TokenMenu = ({
{selectedAssetCount} {selectedAssetCount === 1 ? 'token' : 'tokens'} selected
</Typography>
</Box>
<Box display="flex" flexDirection="row" gap={1}>
<Stack direction="row" spacing={1}>
<Track {...ASSETS_EVENTS.CANCEL_HIDE_DIALOG}>
<Button onClick={cancel} className={css.cancelButton} size="small" variant="outlined">
Cancel
Expand All @@ -47,7 +47,7 @@ const TokenMenu = ({
Save
</Button>
</Track>
</Box>
</Stack>
</Box>
</Sticky>
)
Expand Down
6 changes: 3 additions & 3 deletions src/components/batch/BatchIndicator/BatchTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type ReactElement, useEffect, useState } from 'react'
import { Box, SvgIcon } from '@mui/material'
import { Box, Stack, SvgIcon } from '@mui/material'

import SuccessIcon from '@/public/images/common/success.svg'
import { TxEvent, txSubscribe } from '@/services/tx/txEvents'
Expand All @@ -25,12 +25,12 @@ const BatchTooltip = ({ children }: { children: ReactElement }) => {
open={showTooltip}
onClose={() => setShowTooltip(false)}
title={
<Box display="flex" flexDirection="column" alignItems="center" p={2} gap={2}>
<Stack alignItems="center" p={2} spacing={2}>
<Box fontSize="53px">
<SvgIcon component={SuccessIcon} inheritViewBox fontSize="inherit" />
</Box>
Transaction is added to batch
</Box>
</Stack>
}
>
<div>{children}</div>
Expand Down
10 changes: 5 additions & 5 deletions src/components/batch/BatchSidebar/EmptyBatch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import InfoIcon from '@/public/images/notifications/info.svg'
import AssetsIcon from '@/public/images/sidebar/assets.svg'
import AppsIcon from '@/public/images/apps/apps-icon.svg'
import SettingsIcon from '@/public/images/sidebar/settings.svg'
import { Box, SvgIcon, Typography } from '@mui/material'
import { Box, Stack, SvgIcon, Typography } from '@mui/material'

const EmptyBatch = ({ children }: { children: ReactNode }) => (
<Box display="flex" flexWrap="wrap" justifyContent="center" textAlign="center" mt={3} px={4}>
<Stack flexWrap="wrap" justifyContent="center" textAlign="center" mt={3} px={4}>
<SvgIcon component={EmptyBatchIcon} inheritViewBox sx={{ fontSize: 110 }} />

<Typography variant="h4" fontWeight={700}>
Expand All @@ -28,7 +28,7 @@ const EmptyBatch = ({ children }: { children: ReactNode }) => (

<b>What type of transactions can you add to the batch?</b>

<Box display="flex" mt={3} gap={6}>
<Stack mt={3} spacing={6}>
<div>
<SvgIcon component={AssetsIcon} inheritViewBox />
<div>Token and NFT transfers</div>
Expand All @@ -43,9 +43,9 @@ const EmptyBatch = ({ children }: { children: ReactNode }) => (
<SvgIcon component={SettingsIcon} inheritViewBox />
<div>Safe Account settings</div>
</div>
</Box>
</Stack>
</Typography>
</Box>
</Stack>
)

export default EmptyBatch
6 changes: 3 additions & 3 deletions src/components/common/ConnectWallet/AccountCenter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MouseEvent } from 'react'
import { useState } from 'react'
import { Box, ButtonBase, Paper, Popover } from '@mui/material'
import { Stack, ButtonBase, Paper, Popover, Box } from '@mui/material'
import css from '@/components/common/ConnectWallet/styles.module.css'
import ExpandLessIcon from '@mui/icons-material/ExpandLess'
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
Expand Down Expand Up @@ -35,9 +35,9 @@ export const AccountCenter = ({ wallet }: { wallet: ConnectedWallet }) => {
<Box className={css.buttonContainer}>
<WalletOverview wallet={wallet} balance={balance} showBalance />

<Box display="flex" alignItems="center" justifyContent="flex-end" ml="auto">
<Stack alignItems="center" justifyContent="flex-end" ml="auto">
{open ? <ExpandLessIcon color="border" /> : <ExpandMoreIcon color="border" />}
</Box>
</Stack>
</Box>
</ButtonBase>

Expand Down
6 changes: 3 additions & 3 deletions src/components/common/CopyAddressButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { checksumAddress } from '@/utils/addresses'
import { Box, Typography } from '@mui/material'
import { Stack, Typography } from '@mui/material'
import type { ReactNode, ReactElement } from 'react'
import CopyButton from '../CopyButton'
import EthHashInfo from '../EthHashInfo'
Expand All @@ -22,7 +22,7 @@ const CopyAddressButton = ({
const checksummedAddress = checksumAddress(address)

const dialogContent = trusted ? undefined : (
<Box display="flex" flexDirection="column" gap={2}>
<Stack spacing={2}>
<EthHashInfo
address={checksummedAddress}
shortAddress={false}
Expand All @@ -34,7 +34,7 @@ const CopyAddressButton = ({
The copied address is linked to a transaction with an untrusted token. Make sure you are interacting with the
right address.
</Typography>
</Box>
</Stack>
)

return (
Expand Down
10 changes: 5 additions & 5 deletions src/components/common/CopyTooltip/ConfirmCopyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
DialogContent,
DialogActions,
Button,
Box,
Stack,
} from '@mui/material'
import WarningIcon from '@/public/images/notifications/warning.svg'
import { type ReactElement, useEffect, type SyntheticEvent } from 'react'
Expand All @@ -35,21 +35,21 @@ const ConfirmCopyModal = ({ open, onClose, onCopy, children }: ConfirmCopyModalP
return (
<Dialog open={open} onClose={onClose}>
<DialogTitle>
<Box data-testid="untrusted-token-warning" display="flex" flexDirection="row" alignItems="center" gap={1}>
<Stack data-testid="untrusted-token-warning" direction="row" alignItems="center" spacing={1}>
<SvgIcon component={WarningIcon} inheritViewBox color="warning" sx={{ mb: -0.4 }} />
<Typography variant="h6" fontWeight={700}>
Before you copy
</Typography>
<IconButton aria-label="close" onClick={onClose} sx={{ marginLeft: 'auto' }}>
<Close />
</IconButton>
</Box>
</Stack>
</DialogTitle>
<Divider />
<DialogContent>{children}</DialogContent>
<Divider />
<DialogActions sx={{ padding: 3 }}>
<Box className={css.dialogActions} gap={1}>
<Stack className={css.dialogActions} spacing={1}>
<Track {...TX_LIST_EVENTS.COPY_WARNING_PROCEED}>
<Button size="small" variant="text" color="primary" onClick={onCopy} fullWidth>
Proceed and copy
Expand All @@ -60,7 +60,7 @@ const ConfirmCopyModal = ({ open, onClose, onCopy, children }: ConfirmCopyModalP
Do not copy
</Button>
</Track>
</Box>
</Stack>
</DialogActions>
</Dialog>
)
Expand Down
6 changes: 3 additions & 3 deletions src/components/common/Countdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Typography, Box } from '@mui/material'
import { Typography, Stack } from '@mui/material'
import type { ReactElement } from 'react'

export function _getCountdown(seconds: number): { days: number; hours: number; minutes: number } {
Expand Down Expand Up @@ -31,11 +31,11 @@ export function Countdown({ seconds }: { seconds: number }): ReactElement | null
const { days, hours, minutes } = _getCountdown(seconds)

return (
<Box display="flex" gap={1}>
<Stack spacing={1}>
<TimeLeft value={days} unit="day" />
<TimeLeft value={hours} unit="hr" />
<TimeLeft value={minutes} unit="min" />
</Box>
</Stack>
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/common/EthHashInfo/SrcEthHashInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import classnames from 'classnames'
import type { ReactNode, ReactElement, SyntheticEvent } from 'react'
import { isAddress } from 'ethers'
import { useTheme } from '@mui/material/styles'
import { Box, SvgIcon, Tooltip } from '@mui/material'
import { Box, Stack, SvgIcon, Tooltip } from '@mui/material'
import AddressBookIcon from '@/public/images/sidebar/address-book.svg'
import useMediaQuery from '@mui/material/useMediaQuery'
import Identicon from '../../Identicon'
Expand Down Expand Up @@ -84,7 +84,7 @@ const SrcEthHashInfo = ({

<Box overflow="hidden" className={onlyName ? css.inline : undefined} gap={0.5}>
{name && (
<Box title={name} display="flex" alignItems="center" gap={0.5}>
<Stack title={name} alignItems="center" spacing={0.5}>
<Box overflow="hidden" textOverflow="ellipsis">
{name}
</Box>
Expand All @@ -96,7 +96,7 @@ const SrcEthHashInfo = ({
</span>
</Tooltip>
)}
</Box>
</Stack>
)}

<div className={classnames(css.addressContainer, { [css.inline]: onlyName })}>
Expand Down
6 changes: 3 additions & 3 deletions src/components/common/ExplorerButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement, ComponentType, SyntheticEvent } from 'react'
import { Box, IconButton, SvgIcon, Tooltip, Typography } from '@mui/material'
import { Stack, IconButton, SvgIcon, Tooltip, Typography } from '@mui/material'
import LinkIcon from '@/public/images/common/link.svg'
import Link from 'next/link'

Expand Down Expand Up @@ -44,13 +44,13 @@ const ExplorerButton = ({
href={href}
onClick={onClick}
>
<Box display="flex" alignItems="center">
<Stack alignItems="center">
<Typography fontWeight={700} fontSize="small" mr="var(--space-1)" noWrap>
View on explorer
</Typography>

<SvgIcon component={icon} inheritViewBox fontSize="small" />
</Box>
</Stack>
</Link>
)
}
Expand Down
Loading
Loading