Pager updated
This commit is contained in:
1 parent
41467aa447
commit
55b4ce14d3
1 file changed
+8
-8
@@ -1,20 +1,20 @@
|
|||||||
import { Block } from '../Block'
|
import { Block, BlockProps } from '../Block'
|
||||||
import { Button } from '../Button'
|
import { Button } from '../Button'
|
||||||
import { Spacer } from '../Spacer'
|
import { Spacer } from '../Spacer'
|
||||||
|
|
||||||
export type PagerProps = {
|
export type PagerProps = Omit<BlockProps, 'direction'> & {
|
||||||
nextHref: string | null
|
nextHref: string | null
|
||||||
prevHref: string | null
|
prevHref: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Pager: React.FC<PagerProps> = props => (
|
export const Pager: React.FC<PagerProps> = ({ prevHref, nextHref, ...props }) => (
|
||||||
<Block direction={'horizontal'}>
|
<Block {...props} direction={'horizontal'}>
|
||||||
{!props.prevHref ? null : (
|
{!prevHref ? null : (
|
||||||
<Button href={props.prevHref}>Предыдущая страница</Button>
|
<Button href={prevHref}>Предыдущая страница</Button>
|
||||||
)}
|
)}
|
||||||
<Spacer />
|
<Spacer />
|
||||||
{!props.nextHref ? null : (
|
{!nextHref ? null : (
|
||||||
<Button href={props.nextHref}>Следущая страница</Button>
|
<Button href={nextHref}>Следущая страница</Button>
|
||||||
)}
|
)}
|
||||||
</Block>
|
</Block>
|
||||||
)
|
)
|
||||||
Reference in new issue
Block a user