Commit ca1dc593 authored by Jack Short's avatar Jack Short Committed by GitHub

style: updating page loader for activity (#5508)

* style: updating page loader for activity

* reusing loader
parent afacc4a3
import { OpacityHoverState } from 'components/Common' import { OpacityHoverState } from 'components/Common'
import { Box } from 'nft/components/Box' import { Box } from 'nft/components/Box'
import { LoadingSparkle } from 'nft/components/common/Loading/LoadingSparkle' import { Column, Row } from 'nft/components/Flex'
import { Center, Column, Row } from 'nft/components/Flex'
import { themeVars, vars } from 'nft/css/sprinkles.css' import { themeVars, vars } from 'nft/css/sprinkles.css'
import { useBag, useIsMobile } from 'nft/hooks' import { useBag, useIsMobile } from 'nft/hooks'
import { ActivityFetcher } from 'nft/queries/genie/ActivityFetcher' import { ActivityFetcher } from 'nft/queries/genie/ActivityFetcher'
...@@ -15,7 +14,7 @@ import styled from 'styled-components/macro' ...@@ -15,7 +14,7 @@ import styled from 'styled-components/macro'
import * as styles from './Activity.css' import * as styles from './Activity.css'
import { AddressCell, BuyCell, EventCell, ItemCell, PriceCell } from './ActivityCells' import { AddressCell, BuyCell, EventCell, ItemCell, PriceCell } from './ActivityCells'
import { ActivityLoader } from './ActivityLoader' import { ActivityLoader, ActivityPageLoader } from './ActivityLoader'
enum ColumnHeaders { enum ColumnHeaders {
Item = 'Item', Item = 'Item',
...@@ -155,13 +154,7 @@ export const Activity = ({ contractAddress, rarityVerified, collectionName, chai ...@@ -155,13 +154,7 @@ export const Activity = ({ contractAddress, rarityVerified, collectionName, chai
<InfiniteScroll <InfiniteScroll
next={fetchNextPage} next={fetchNextPage}
hasMore={!!hasNextPage} hasMore={!!hasNextPage}
loader={ loader={isFetchingNextPage ? <ActivityPageLoader rowCount={2} /> : null}
isFetchingNextPage ? (
<Center paddingY="20">
<LoadingSparkle />
</Center>
) : null
}
dataLength={events?.length ?? 0} dataLength={events?.length ?? 0}
style={{ overflow: 'unset' }} style={{ overflow: 'unset' }}
> >
......
...@@ -13,30 +13,44 @@ const LoadingSliver = () => { ...@@ -13,30 +13,44 @@ const LoadingSliver = () => {
return <Box className={styles.loadingSliver} /> return <Box className={styles.loadingSliver} />
} }
const ActivityLoadingRow = () => {
return (
<Box as="a" className={eventRow}>
<Row gap="16">
<LoadingSquare />
<LoadingSliver />
</Row>
<Row>
<LoadingSliver />
</Row>
<Row display={{ sm: 'none', md: 'flex' }}>
<LoadingSliver />
</Row>
<Row display={{ sm: 'none', lg: 'flex' }}>
<LoadingSliver />
</Row>
<Row display={{ sm: 'none', xl: 'flex' }}>
<LoadingSliver />
</Row>
</Box>
)
}
export const ActivityPageLoader = ({ rowCount }: { rowCount: number }) => {
return (
<>
{[...Array(rowCount)].map((_, index) => (
<ActivityLoadingRow key={index} />
))}
</>
)
}
export const ActivityLoader = () => { export const ActivityLoader = () => {
return ( return (
<Column marginTop="36"> <Column marginTop="36">
<HeaderRow /> <HeaderRow />
{[...Array(10)].map((_, i) => ( <ActivityPageLoader rowCount={10} />
<Box as="a" className={eventRow} key={i}>
<Row gap="16">
<LoadingSquare />
<LoadingSliver />
</Row>
<Row>
<LoadingSliver />
</Row>
<Row display={{ sm: 'none', md: 'flex' }}>
<LoadingSliver />
</Row>
<Row display={{ sm: 'none', lg: 'flex' }}>
<LoadingSliver />
</Row>
<Row display={{ sm: 'none', xl: 'flex' }}>
<LoadingSliver />
</Row>
</Box>
))}
</Column> </Column>
) )
} }
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