Skip to content

Commit

Permalink
Mobile CSS + add import/export
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Feb 9, 2024
1 parent 33acfcb commit e4ca81b
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 14 deletions.
11 changes: 9 additions & 2 deletions src/components/common/ChainIndicator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type ChainIndicatorProps = {
className?: string
showUnknown?: boolean
showLogo?: boolean
responsive?: boolean
}

const fallbackChainConfig = {
Expand All @@ -32,6 +33,7 @@ const ChainIndicator = ({
inline = false,
showUnknown = true,
showLogo = true,
responsive = false,
}: ChainIndicatorProps): ReactElement | null => {
const currentChainId = useChainId()
const id = chainId || currentChainId
Expand All @@ -56,7 +58,12 @@ const ChainIndicator = ({
<span
data-testid="chain-logo"
style={showLogo ? undefined : style}
className={classnames(inline ? css.inlineIndicator : css.indicator, showLogo ? css.withLogo : '', className)}
className={classnames(className || '', {
[css.inlineIndicator]: inline,
[css.indicator]: !inline,
[css.withLogo]: showLogo,
[css.responsive]: responsive,
})}
>
{showLogo && (
<img
Expand All @@ -68,7 +75,7 @@ const ChainIndicator = ({
/>
)}

{chainConfig.chainName}
<span className={css.name}>{chainConfig.chainName}</span>
</span>
) : null
}
Expand Down
6 changes: 6 additions & 0 deletions src/components/common/ChainIndicator/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@
padding: 0;
font-size: 14px;
}

@media (max-width: 899.95px) {
.responsive .name {
display: none;
}
}
5 changes: 3 additions & 2 deletions src/components/welcome/MyAccounts/AccountItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const AccountItem = ({ chainId, address, ...rest }: AccountItemProps) => {
<Link href={href} className={css.safeLink}>
<SafeIcon address={address} {...rest} />

<Typography variant="body2" component="div">
<Typography variant="body2" component="div" className={css.safeAddress}>
{name && (
<Typography fontWeight="bold" fontSize="inherit">
{name}
Expand All @@ -54,9 +54,10 @@ const AccountItem = ({ chainId, address, ...rest }: AccountItemProps) => {

<Box flex={1} />

<ChainIndicator chainId={chainId} />
<ChainIndicator chainId={chainId} responsive />
</Link>
</Track>

<SafeListContextMenu name={name} address={address} chainId={chainId} />
</ListItemButton>
)
Expand Down
8 changes: 6 additions & 2 deletions src/components/welcome/MyAccounts/CreateButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ const CreateButton = () => {
const currentChain = useCurrentChain()

return (
<Link href={{ pathname: AppRoutes.newSafe.create, query: { chain: currentChain?.shortName } }}>
<Button disableElevation size="small" variant="contained">
<Link
href={{ pathname: AppRoutes.newSafe.create, query: { chain: currentChain?.shortName } }}
passHref
legacyBehavior
>
<Button disableElevation size="small" variant="contained" sx={{ width: ['100%', 'auto'] }} component="a">
Create account
</Button>
</Link>
Expand Down
10 changes: 7 additions & 3 deletions src/components/welcome/MyAccounts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import CreateButton from './CreateButton'
import useAllSafes, { type SafeItems } from './useAllSafes'
import Track from '@/components/common/Track'
import { OVERVIEW_EVENTS } from '@/services/analytics'
import { DataWidget } from '@/components/welcome/SafeListDrawer/DataWidget'
import css from './styles.module.css'

type AccountsListProps = {
safes: SafeItems
Expand All @@ -31,8 +33,8 @@ const AccountsList = ({ safes }: AccountsListProps) => {

return (
<Box display="flex" justifyContent="center">
<Box width={600} m={2}>
<Box display="flex" justifyContent="space-between" py={3}>
<Box className={css.container} m={2}>
<Box display="flex" flexWrap="wrap" justifyContent="space-between" py={3} gap={2}>
<Typography variant="h1" fontWeight={700}>
My Safe accounts
<Typography component="span" color="text.secondary" fontSize="inherit" fontWeight="normal">
Expand All @@ -44,7 +46,7 @@ const AccountsList = ({ safes }: AccountsListProps) => {
<CreateButton />
</Box>

<Paper sx={{ p: 3 }}>
<Paper sx={{ p: 3, mb: 3 }}>
{shownSafes.length ? (
shownSafes.map((item) => <AccountItem {...item} key={item.chainId + item.address} />)
) : (
Expand All @@ -61,6 +63,8 @@ const AccountsList = ({ safes }: AccountsListProps) => {
</Box>
)}
</Paper>

<DataWidget />
</Box>
</Box>
)
Expand Down
28 changes: 23 additions & 5 deletions src/components/welcome/MyAccounts/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
.container {
width: 600px;
}

.listItem {
gap: var(--space-2);
border: 1px solid var(--color-border-light);
border-radius: var(--space-1);
margin-bottom: 12px;
padding-top: var(--space-2);
padding-bottom: var(--space-2);
}

.listItem> :first-child {
display: block;
.listItem > :first-child {
flex: 1;
}

.safeLink {
display: flex;
gap: var(--space-2);
align-items: center;
}
padding-right: var(--space-2);
}

.safeAddress {
flex: 1;
white-space: nowrap;
padding-left: var(--space-2);
}

@media (max-width: 899.95px) {
.container {
width: auto;
}

.safeLink {
padding-right: 0;
}
}

0 comments on commit e4ca81b

Please sign in to comment.