pager update
This commit is contained in:
1 parent
5a3fc93c4f
commit
406c660f41
5 files changed
+37
-35
No files matched your search
@@ -0,0 +1,34 @@
|
||||
const text = ['↑', '↓']
|
||||
const linkText = ['Предыдущая страница', 'Следующая страница']
|
||||
|
||||
type Position = 'top' | 'bottom'
|
||||
const i = (type: Position) => type === 'top'
|
||||
? 0
|
||||
: 1
|
||||
|
||||
export type PagerProps = {
|
||||
url: string
|
||||
position: Position
|
||||
}
|
||||
|
||||
export const Pager: React.FC<PagerProps> = ({ url, position }) => (
|
||||
<div>
|
||||
<style jsx>{`
|
||||
div {
|
||||
text-align: center;
|
||||
margin-top: var(--size-m);
|
||||
margin-bottom: var(--size-m);
|
||||
}
|
||||
|
||||
span {
|
||||
margin: 0 var(--size-s);
|
||||
}
|
||||
`}</style>
|
||||
|
||||
<span>
|
||||
{text[i(position)]}
|
||||
</span>
|
||||
|
||||
<a href={url}>{linkText[i(position)]}</a>
|
||||
</div>
|
||||
)
|
||||
Reference in new issue
Block a user