feat(validator info): create handlers for change of interval
This commit is contained in:
parent
8250429bcd
commit
3220e3b6c0
|
@ -10,6 +10,17 @@ const ValidatorInfo = () => {
|
||||||
const intervalsOfTime = ['Day', 'Week', 'Month', 'Year']
|
const intervalsOfTime = ['Day', 'Week', 'Month', 'Year']
|
||||||
const [currentInterval, setCurrentInterval] = useState(0)
|
const [currentInterval, setCurrentInterval] = useState(0)
|
||||||
|
|
||||||
|
const toggleIntervalChange = () => {
|
||||||
|
setCurrentInterval(
|
||||||
|
prevInterval => (prevInterval + 1) % intervalsOfTime.length,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const togglePreviousInterval = () => {
|
||||||
|
setCurrentInterval(
|
||||||
|
prevInterval => (prevInterval - 1 + intervalsOfTime.length) % intervalsOfTime.length,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<XStack space={'$2'} justifyContent="space-between">
|
<XStack space={'$2'} justifyContent="space-between">
|
||||||
<XStack space="$2">
|
<XStack space="$2">
|
||||||
|
@ -55,11 +66,13 @@ const ValidatorInfo = () => {
|
||||||
size={16}
|
size={16}
|
||||||
style={{ cursor: 'pointer' }}
|
style={{ cursor: 'pointer' }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
togglePreviousInterval()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ChevronRightIcon
|
<ChevronRightIcon
|
||||||
size={16}
|
size={16}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
toggleIntervalChange()
|
||||||
}}
|
}}
|
||||||
style={{ cursor: 'pointer' }}
|
style={{ cursor: 'pointer' }}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue