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,12 +13,9 @@ const LoadingSliver = () => { ...@@ -13,12 +13,9 @@ const LoadingSliver = () => {
return <Box className={styles.loadingSliver} /> return <Box className={styles.loadingSliver} />
} }
export const ActivityLoader = () => { const ActivityLoadingRow = () => {
return ( return (
<Column marginTop="36"> <Box as="a" className={eventRow}>
<HeaderRow />
{[...Array(10)].map((_, i) => (
<Box as="a" className={eventRow} key={i}>
<Row gap="16"> <Row gap="16">
<LoadingSquare /> <LoadingSquare />
<LoadingSliver /> <LoadingSliver />
...@@ -36,7 +33,24 @@ export const ActivityLoader = () => { ...@@ -36,7 +33,24 @@ export const ActivityLoader = () => {
<LoadingSliver /> <LoadingSliver />
</Row> </Row>
</Box> </Box>
)
}
export const ActivityPageLoader = ({ rowCount }: { rowCount: number }) => {
return (
<>
{[...Array(rowCount)].map((_, index) => (
<ActivityLoadingRow key={index} />
))} ))}
</>
)
}
export const ActivityLoader = () => {
return (
<Column marginTop="36">
<HeaderRow />
<ActivityPageLoader rowCount={10} />
</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