Skip to content

Commit

Permalink
Move Typography into AccountLink
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Mar 17, 2023
1 parent e1368b6 commit 1c1563e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
18 changes: 12 additions & 6 deletions src/app/components/Account/AccountLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ import Link from '@mui/material/Link'
import { TrimLinkLabel } from '../TrimLinkLabel'
import { RouteUtils } from '../../utils/route-utils'
import { Layer } from '../../../oasis-indexer/api'
import Typography from '@mui/material/Typography'
import { COLORS } from '../../../styles/theme/colors'

export const AccountLink: FC<{ address: string; layer: Layer }> = ({ address, layer }) => {
const theme = useTheme()
const isMobile = useMediaQuery(theme.breakpoints.down('sm'))
const to = RouteUtils.getAccountRoute(address, layer)
return isMobile ? (
<TrimLinkLabel label={address} to={to} />
) : (
<Link component={RouterLink} to={to}>
{address}
</Link>
return (
<Typography variant="mono" component="span" sx={{ color: COLORS.brandDark, fontWeight: 700 }}>
{isMobile ? (
<TrimLinkLabel label={address} to={to} />
) : (
<Link component={RouterLink} to={to}>
{address}
</Link>
)}
</Typography>
)
}
8 changes: 2 additions & 6 deletions src/app/pages/TransactionDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,15 @@ export const TransactionDetailView: FC<{

<dt>{t('common.from')}</dt>
<dd>
<Typography variant="mono" component="span" sx={{ color: COLORS.brandDark, fontWeight: 700 }}>
<AccountLink address={transaction.sender_0} layer={transaction.layer} />
</Typography>
<AccountLink address={transaction.sender_0} layer={transaction.layer} />
<CopyToClipboard value={transaction.sender_0} label={' '} />
</dd>

{transaction.to && (
<>
<dt>{t('common.to')}</dt>
<dd>
<Typography variant="mono" component="span" sx={{ color: COLORS.brandDark, fontWeight: 700 }}>
<AccountLink address={transaction.to} layer={transaction.layer} />
</Typography>
<AccountLink address={transaction.to} layer={transaction.layer} />
<CopyToClipboard value={transaction.to} label={' '} />
</dd>
</>
Expand Down

0 comments on commit 1c1563e

Please sign in to comment.