Commit 6aee7224 authored by isstuev's avatar isstuev

fix sticky header top

parent 30f609ca
...@@ -97,7 +97,7 @@ const AddressBlocksValidated = ({ scrollRef }: Props) => { ...@@ -97,7 +97,7 @@ const AddressBlocksValidated = ({ scrollRef }: Props) => {
<> <>
<Hide below="lg" ssr={ false }> <Hide below="lg" ssr={ false }>
<Table variant="simple" size="sm"> <Table variant="simple" size="sm">
<Thead top={ 80 }> <Thead top={ query.isPaginationVisible ? 80 : 0 }>
<Tr> <Tr>
<Th width="17%">Block</Th> <Th width="17%">Block</Th>
<Th width="17%">Age</Th> <Th width="17%">Age</Th>
......
...@@ -196,7 +196,7 @@ const AddressTokenTransfers = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLD ...@@ -196,7 +196,7 @@ const AddressTokenTransfers = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLD
data={ items } data={ items }
baseAddress={ currentAddress } baseAddress={ currentAddress }
showTxInfo showTxInfo
top={ 80 } top={ isActionBarHidden ? 0 : 80 }
enableTimeIncrement enableTimeIncrement
showSocketInfo={ pagination.page === 1 && !tokenFilter } showSocketInfo={ pagination.page === 1 && !tokenFilter }
socketInfoAlert={ socketAlert } socketInfoAlert={ socketAlert }
......
...@@ -47,7 +47,7 @@ const AddressCoinBalanceHistory = ({ query }: Props) => { ...@@ -47,7 +47,7 @@ const AddressCoinBalanceHistory = ({ query }: Props) => {
<> <>
<Hide below="lg" ssr={ false }> <Hide below="lg" ssr={ false }>
<Table variant="simple" size="sm"> <Table variant="simple" size="sm">
<Thead top={ 80 }> <Thead top={ query.isPaginationVisible ? 80 : 0 }>
<Tr> <Tr>
<Th width="20%">Block</Th> <Th width="20%">Block</Th>
<Th width="20%">Txn</Th> <Th width="20%">Txn</Th>
......
...@@ -12,13 +12,14 @@ interface Props { ...@@ -12,13 +12,14 @@ interface Props {
items: Array<AddressesItem>; items: Array<AddressesItem>;
totalSupply: string; totalSupply: string;
pageStartIndex: number; pageStartIndex: number;
top: number;
} }
const AddressesTable = ({ items, totalSupply, pageStartIndex }: Props) => { const AddressesTable = ({ items, totalSupply, pageStartIndex, top }: Props) => {
const hasPercentage = Boolean(totalSupply && totalSupply !== '0'); const hasPercentage = Boolean(totalSupply && totalSupply !== '0');
return ( return (
<Table variant="simple" size="sm"> <Table variant="simple" size="sm">
<Thead top={ 80 }> <Thead top={ top }>
<Tr> <Tr>
<Th width="64px">Rank</Th> <Th width="64px">Rank</Th>
<Th width={ hasPercentage ? '30%' : '40%' }>Address</Th> <Th width={ hasPercentage ? '30%' : '40%' }>Address</Th>
......
...@@ -101,8 +101,12 @@ const BlocksContent = ({ type, query }: Props) => { ...@@ -101,8 +101,12 @@ const BlocksContent = ({ type, query }: Props) => {
return ( return (
<> <>
{ socketAlert && <Alert status="warning" mb={ 6 } as="a" href={ window.document.location.href }>{ socketAlert }</Alert> } { socketAlert && <Alert status="warning" mb={ 6 } as="a" href={ window.document.location.href }>{ socketAlert }</Alert> }
<Show below="lg" key="content-mobile" ssr={ false }><BlocksList data={ query.data.items }/></Show> <Show below="lg" key="content-mobile" ssr={ false }>
<Hide below="lg" key="content-desktop" ssr={ false }><BlocksTable data={ query.data.items } top={ 80 } page={ 1 }/></Hide> <BlocksList data={ query.data.items }/>
</Show>
<Hide below="lg" key="content-desktop" ssr={ false }>
<BlocksTable data={ query.data.items } top={ query.isPaginationVisible ? 80 : 0 } page={ query.pagination.page }/>
</Hide>
</> </>
); );
......
...@@ -47,6 +47,7 @@ const Accounts = () => { ...@@ -47,6 +47,7 @@ const Accounts = () => {
{ bar } { bar }
<Hide below="lg" ssr={ false }> <Hide below="lg" ssr={ false }>
<AddressesTable <AddressesTable
top={ isPaginationVisible ? 80 : 0 }
items={ data.items } items={ data.items }
totalSupply={ data.total_supply } totalSupply={ data.total_supply }
pageStartIndex={ pageStartIndex } pageStartIndex={ pageStartIndex }
......
...@@ -57,7 +57,7 @@ const TokenHoldersContent = ({ holdersQuery, tokenQuery }: Props) => { ...@@ -57,7 +57,7 @@ const TokenHoldersContent = ({ holdersQuery, tokenQuery }: Props) => {
return ( return (
<> <>
{ bar } { bar }
{ !isMobile && <TokenHoldersTable data={ items } token={ tokenQuery.data }/> } { !isMobile && <TokenHoldersTable data={ items } token={ tokenQuery.data } top={ holdersQuery.isPaginationVisible ? 80 : 0 }/> }
{ isMobile && <TokenHoldersList data={ items } token={ tokenQuery.data }/> } { isMobile && <TokenHoldersList data={ items } token={ tokenQuery.data }/> }
</> </>
); );
......
...@@ -12,7 +12,7 @@ test('base view', async({ mount }) => { ...@@ -12,7 +12,7 @@ test('base view', async({ mount }) => {
const component = await mount( const component = await mount(
<TestApp> <TestApp>
<Box h="128px"/> <Box h="128px"/>
<TokenHoldersTable data={ tokenHolders.items } token={ tokenInfo }/> <TokenHoldersTable data={ tokenHolders.items } token={ tokenInfo } top={ 80 }/>
</TestApp>, </TestApp>,
); );
......
...@@ -9,12 +9,13 @@ import TokenHoldersTableItem from 'ui/token/TokenHolders/TokenHoldersTableItem'; ...@@ -9,12 +9,13 @@ import TokenHoldersTableItem from 'ui/token/TokenHolders/TokenHoldersTableItem';
interface Props { interface Props {
data: Array<TokenHolder>; data: Array<TokenHolder>;
token: TokenInfo; token: TokenInfo;
top: number;
} }
const TokenHoldersTable = ({ data, token }: Props) => { const TokenHoldersTable = ({ data, token, top }: Props) => {
return ( return (
<Table variant="simple" size="sm"> <Table variant="simple" size="sm">
<Thead top={ 80 }> <Thead top={ top }>
<Tr> <Tr>
<Th>Holder</Th> <Th>Holder</Th>
<Th isNumeric width="300px">Quantity</Th> <Th isNumeric width="300px">Quantity</Th>
......
...@@ -91,7 +91,7 @@ const TokenTransfer = ({ transfersQuery, token }: Props) => { ...@@ -91,7 +91,7 @@ const TokenTransfer = ({ transfersQuery, token }: Props) => {
<Hide below="lg" ssr={ false }> <Hide below="lg" ssr={ false }>
<TokenTransferTable <TokenTransferTable
data={ items } data={ items }
top={ 80 } top={ isPaginationVisible ? 80 : 0 }
// token transfers query depends on token data // token transfers query depends on token data
// so if we are here, we definitely have token data // so if we are here, we definitely have token data
token={ token as TokenInfo } token={ token as TokenInfo }
......
...@@ -84,7 +84,7 @@ const TxTokenTransfer = () => { ...@@ -84,7 +84,7 @@ const TxTokenTransfer = () => {
return ( return (
<> <>
<Hide below="lg" ssr={ false }> <Hide below="lg" ssr={ false }>
<TokenTransferTable data={ items } top={ 80 }/> <TokenTransferTable data={ items } top={ isActionBarHidden ? 0 : 80 }/>
</Hide> </Hide>
<Show below="lg" ssr={ false }> <Show below="lg" ssr={ false }>
<TokenTransferList data={ items }/> <TokenTransferList data={ items }/>
......
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