-
Notifications
You must be signed in to change notification settings - Fork 331
/
Copy pathpagination-ellipsis.tsx
64 lines (58 loc) · 1.63 KB
/
pagination-ellipsis.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React, { useState } from 'react'
import PaginationItem from './pagination-item'
interface Props {
isBefore?: boolean
onClick?: (e: React.MouseEvent) => void
}
const PaginationEllipsis: React.FC<Props> = ({ isBefore, onClick }) => {
const [showMore, setShowMore] = useState(false)
return (
<PaginationItem
onClick={e => onClick && onClick(e)}
onMouseEnter={() => setShowMore(true)}
onMouseLeave={() => setShowMore(false)}
>
{showMore ? (
<svg
className="more"
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
fill="none"
shapeRendering="geometricPrecision"
>
<path d="M13 17l5-5-5-5" />
<path d="M6 17l5-5-5-5" />
</svg>
) : (
<svg
viewBox="0 0 24 24"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
fill="none"
shapeRendering="geometricPrecision"
>
<circle cx="12" cy="12" r="1" fill="currentColor" />
<circle cx="19" cy="12" r="1" fill="currentColor" />
<circle cx="5" cy="12" r="1" fill="currentColor" />
</svg>
)}
<style jsx>{`
svg {
color: currentColor;
stroke: currentColor;
width: 1em;
height: 1em;
}
.more {
transform: rotate(${isBefore ? '180deg' : '0deg'});
}
`}</style>
</PaginationItem>
)
}
PaginationEllipsis.displayName = 'GeistPaginationEllipsis'
export default PaginationEllipsis