Skip to content

Commit

Permalink
fix: tx and address page summary mobile style
Browse files Browse the repository at this point in the history
  • Loading branch information
He1DAr committed Jan 12, 2024
1 parent 15de312 commit 3acc1a2
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/app/address/[principal]/AddressSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const AddressSummary = ({
}: AddressSummaryProps) => {
return (
<Section title="Summary">
<Flex px="16px" width="100%" flexDirection={['column', 'column', 'row']}>
<Flex width="100%" flexDirection={['column', 'column', 'row']}>
<Box width={['100%']}>
<KeyValueHorizontal
label={'Address'}
Expand Down
2 changes: 1 addition & 1 deletion src/app/txid/[txId]/CoinbasePage/TxDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface TxDetailsProps {
export const TxDetails: React.FC<TxDetailsProps> = ({ tx }) => {
return (
<Section title="Summary">
<Flex px="16px" width="100%" flexDirection={['column', 'column', 'row']}>
<Flex width="100%" flexDirection={['column', 'column', 'row']}>
<Box width={['100%']}>
<ID tx={tx} />
<Sender tx={tx} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/txid/[txId]/ContractCall/TxDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const TxDetails: React.FC<TxDetailsProps> = ({ tx }) => {
return (
<>
<Section title="Summary">
<Flex px="16px" width="100%" flexDirection={['column', 'column', 'row']}>
<Flex width="100%" flexDirection={['column', 'column', 'row']}>
<Box width={['100%']}>
<ContractName tx={tx} />
<ID tx={tx} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/txid/[txId]/PoisonMicroblock/TxDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const TxDetails: React.FC<TxDetailsProps> = ({ tx }) => {
return (
<>
<Section title="Summary">
<Flex px="16px" width="100%" flexDirection={['column', 'column', 'row']}>
<Flex width="100%" flexDirection={['column', 'column', 'row']}>
<Box width={['100%']}>
<Sender tx={tx} />
<ID tx={tx} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/txid/[txId]/SmartContract/TxDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const TxDetails: React.FC<TxDetailsProps> = ({ tx, block }) => {
return (
<>
<Section title="Summary">
<Flex px="16px" width="100%" flexDirection={['column', 'column', 'row']}>
<Flex width="100%" flexDirection={['column', 'column', 'row']}>
<Box width={['100%']}>
<ContractName tx={tx} />
<ID tx={tx} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/txid/[txId]/TenureChange/TxDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const TxDetails: React.FC<TxDetailsProps> = ({ tx }) => {
return (
<>
<Section title="Summary">
<Flex px="16px" width="100%" flexDirection={['column', 'column', 'row']}>
<Flex width="100%" flexDirection={['column', 'column', 'row']}>
<Box width={['100%']}>
<Sender tx={tx} />
<ID tx={tx} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/txid/[txId]/TokenTransfer/TxDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const TxDetails: React.FC<TxDetailsProps> = ({ tx }) => {
return (
<>
<Section title="Summary">
<Flex px="16px" width="100%" flexDirection={['column', 'column', 'row']}>
<Flex width="100%" flexDirection={['column', 'column', 'row']}>
<Box width={['100%']}>
<Amount tx={tx} />
<Sender tx={tx} />
Expand Down
10 changes: 3 additions & 7 deletions src/app/txid/[txId]/TxDetails/Amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { KeyValueHorizontal } from '../../../../common/components/KeyValueHorizo
import { StxPriceButton } from '../../../../common/components/StxPriceButton';
import { microToStacks, microToStacksFormatted } from '../../../../common/utils/utils';
import { Box } from '../../../../ui/Box';
import { Flex } from '../../../../ui/Flex';
import { HStack } from '../../../../ui/HStack';
import { Icon } from '../../../../ui/Icon';
import { Stack } from '../../../../ui/Stack';
Expand All @@ -25,13 +26,8 @@ export const Amount: FC<{ tx: TokenTransferTransaction | MempoolTokenTransferTra
<KeyValueHorizontal
label={'Amount'}
value={
<>
<Flex alignItems={'center'}>
<HStack alignItems="flex-start" gap={2}>
<Box width="24px" position="relative">
<Circle position="absolute" left={0} size="24px" bg={'accent'}>
<Icon as={StxIcon} size="14px" color="white" />
</Circle>
</Box>
<Text fontSize="16px" color={'textTitle'} fontWeight="500">
{stxValue}{' '}
<Text as="span" display="inline" opacity="0.5">
Expand All @@ -40,7 +36,7 @@ export const Amount: FC<{ tx: TokenTransferTransaction | MempoolTokenTransferTra
</Text>
</HStack>
<StxPriceButton tx={tx} value={Number(tx.token_transfer.amount)} />
</>
</Flex>
}
copyValue={stxValue.toString()}
/>
Expand Down
9 changes: 3 additions & 6 deletions src/app/txid/[txId]/TxDetails/Fees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ export const Fees: FC<{ tx: Transaction | MempoolTransaction }> = ({ tx }) => {
<KeyValueHorizontal
label={'Fees'}
value={
<>
<Flex
flexDirection={['column', 'column', 'row']}
alignItems={['flex-start', 'flex-start', 'center']}
>
<Flex alignItems={'center'}>
<Flex alignItems={'center'}>
<Value>{stxValue} STX</Value>
<StxPriceButton tx={tx} value={Number(tx.fee_rate)} />
</Flex>
Expand All @@ -34,7 +31,7 @@ export const Fees: FC<{ tx: Transaction | MempoolTransaction }> = ({ tx }) => {
Sponsored
</Badge>
) : null}
</>
</Flex>
}
copyValue={stxValue.toString()}
/>
Expand Down
28 changes: 19 additions & 9 deletions src/common/components/KeyValueHorizontal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { css } from '@emotion/react';
import { FC, ReactNode } from 'react';

import { Flex, FlexProps } from '../../ui/Flex';
import { Show } from '../../ui/Show';
import { CopyButton } from './CopyButton';

export interface KeyValueHorizontalProps {
Expand Down Expand Up @@ -39,34 +40,43 @@ export const KeyValueHorizontal: FC<KeyValueHorizontalProps> = ({
return (
<Flex
py={'16px'}
alignItems={'center'}
alignItems={['flex-start', 'flex-start', 'center']}
css={rowStyle}
gap={'10px'}
flexWrap="nowrap"
minHeight={'73px'}
borderBottom={'1px'}
borderColor={borderColor}
_last={{ borderBottom: 'unset' }}
direction={['column', 'column', 'row']}
>
<Flex fontSize={'12px'} color={'textCaption'} width={'140px'} flexShrink={0} {...labelProps}>
<Flex
fontSize={'12px'}
color={'textCaption'}
width={['full', 'full', '140px']}
flexShrink={0}
{...labelProps}
>
{label}
</Flex>
<Flex
flexDirection={['column', 'column', 'row']}
alignItems={['flex-start', 'flex-start', 'center']}
maxWidth={'calc(100% - 180px)'}
maxWidth={['full', 'full', 'calc(100% - 180px)']}
wordBreak={'break-all'}
fontSize={'sm'}
>
{value}
</Flex>
{copyValue && (
<CopyButton
className={'fancy-copy'}
initialValue={copyValue}
aria-label={'copy row'}
size={'40px'}
/>
<Show above="lg">
<CopyButton
className={'fancy-copy'}
initialValue={copyValue}
aria-label={'copy row'}
size={'40px'}
/>
</Show>
)}
</Flex>
);
Expand Down

0 comments on commit 3acc1a2

Please sign in to comment.