Commit f464b9ab authored by tom's avatar tom

scroll

parent 166046d7
...@@ -67,8 +67,10 @@ const TxDetailsAction = ({ action }: Props) => { ...@@ -67,8 +67,10 @@ const TxDetailsAction = ({ action }: Props) => {
/> />
<chakra.span color="text_secondary">{ text1 } </chakra.span> <chakra.span color="text_secondary">{ text1 } </chakra.span>
<Icon as={ uniswapIcon } boxSize={ 5 } color="white" bgColor="#ff007a" borderRadius="full" p="2px"/> <Flex columnGap={ 1 }>
<chakra.span color="text_secondary">Uniswap V3</chakra.span> <Icon as={ uniswapIcon } boxSize={ 5 } color="white" bgColor="#ff007a" borderRadius="full" p="2px"/>
<chakra.span color="text_secondary">Uniswap V3</chakra.span>
</Flex>
</Flex> </Flex>
); );
} }
...@@ -76,8 +78,8 @@ const TxDetailsAction = ({ action }: Props) => { ...@@ -76,8 +78,8 @@ const TxDetailsAction = ({ action }: Props) => {
case 'mint_nft' : { case 'mint_nft' : {
return ( return (
<div> <div>
<Flex rowGap={ 2 } flexWrap="wrap" whiteSpace="pre-wrap"> <Flex rowGap={ 2 } flexWrap="wrap" alignItems="center" whiteSpace="pre-wrap">
<span>Mint of </span> <chakra.span>Mint of </chakra.span>
<TokenSnippet <TokenSnippet
name={ data.name } name={ data.name }
hash={ data.address } hash={ data.address }
...@@ -85,8 +87,10 @@ const TxDetailsAction = ({ action }: Props) => { ...@@ -85,8 +87,10 @@ const TxDetailsAction = ({ action }: Props) => {
w="auto" w="auto"
columnGap={ 1 } columnGap={ 1 }
logoSize={ 5 } logoSize={ 5 }
rowGap={ 2 }
flexWrap="wrap"
/> />
<span> to </span> <chakra.span> to </chakra.span>
<AddressLink hash={ data.to } type="address" truncation="constant"/> <AddressLink hash={ data.to } type="address" truncation="constant"/>
</Flex> </Flex>
......
import { Flex } from '@chakra-ui/react'; import { Flex, useColorModeValue } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { TxAction } from 'types/api/txAction'; import type { TxAction } from 'types/api/txAction';
...@@ -12,17 +12,45 @@ interface Props { ...@@ -12,17 +12,45 @@ interface Props {
} }
const TxDetailsActions = ({ actions }: Props) => { const TxDetailsActions = ({ actions }: Props) => {
const containerRef = React.useRef<HTMLDivElement>(null);
const [ hasScroll, setHasScroll ] = React.useState(false);
const gradientStartColor = useColorModeValue('whiteAlpha.600', 'blackAlpha.600');
const gradientEndColor = useColorModeValue('whiteAlpha.900', 'blackAlpha.900');
React.useEffect(() => {
if (!containerRef.current) {
return;
}
setHasScroll(containerRef.current.scrollHeight > containerRef.current.clientHeight);
}, []);
return ( return (
<DetailsInfoItem <DetailsInfoItem
title="Transaction Action" title="Transaction Action"
hint="Highlighted events of the transaction" hint="Highlighted events of the transaction"
note="Scroll to see more" note={ hasScroll ? 'Scroll to see more' : undefined }
position="relative"
> >
<Flex <Flex
flexDirection="column" flexDirection="column"
alignItems="flex-start" alignItems="flex-start"
rowGap={ 5 } rowGap={ 5 }
w="100%" w="100%"
maxH="200px"
overflowY="scroll"
ref={ containerRef }
_after={ hasScroll ? {
position: 'absolute',
content: '""',
bottom: 0,
left: 0,
right: '20px',
height: '48px',
bgGradient: `linear(to-b, ${ gradientStartColor } 37.5%, ${ gradientEndColor } 77.5%)`,
} : undefined }
pr={ hasScroll ? 5 : 0 }
pb={ hasScroll ? 10 : 0 }
> >
{ actions.map((action, index: number) => <TxDetailsAction key={ index } action={ action }/>) } { actions.map((action, index: number) => <TxDetailsAction key={ index } action={ action }/>) }
</Flex> </Flex>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment