2020-10-06 20:28:38 +02:00
|
|
|
import React from 'react'
|
|
|
|
import { number } from '@storybook/addon-knobs/react'
|
|
|
|
import CountdownTimer from './countdown-timer'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'CountdownTimer',
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
const getTimeStartedFromDecrimentSeconds = (seconds) =>
|
|
|
|
Date.now() - seconds * 1000
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
export const Default = () => {
|
2020-11-03 00:41:28 +01:00
|
|
|
const timeStartedSecondDecriment = number(
|
|
|
|
'Set timeStarted to curren time minus X seconds',
|
|
|
|
10,
|
|
|
|
)
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<CountdownTimer
|
2020-11-03 00:41:28 +01:00
|
|
|
timeStarted={getTimeStartedFromDecrimentSeconds(
|
|
|
|
timeStartedSecondDecriment,
|
|
|
|
)}
|
2020-10-06 20:28:38 +02:00
|
|
|
timeOnly
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export const CustomTimerBase = () => {
|
2020-11-03 00:41:28 +01:00
|
|
|
const timeStartedSecondDecriment = number(
|
|
|
|
'Set timeStarted to curren time minus X seconds',
|
|
|
|
10,
|
|
|
|
)
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<CountdownTimer
|
2020-11-03 00:41:28 +01:00
|
|
|
timeStarted={getTimeStartedFromDecrimentSeconds(
|
|
|
|
timeStartedSecondDecriment,
|
|
|
|
)}
|
2020-10-06 20:28:38 +02:00
|
|
|
timerBase={150000}
|
|
|
|
timeOnly
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Label keys used in below stories are just for demonstration purposes
|
|
|
|
export const WithLabelInfoTooltipAndWarning = () => {
|
2020-11-03 00:41:28 +01:00
|
|
|
const timeStartedSecondDecriment = number(
|
|
|
|
'Set timeStarted to curren time minus X seconds',
|
|
|
|
0,
|
|
|
|
)
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<CountdownTimer
|
2020-11-03 00:41:28 +01:00
|
|
|
timeStarted={getTimeStartedFromDecrimentSeconds(
|
|
|
|
timeStartedSecondDecriment,
|
|
|
|
)}
|
2020-10-06 20:28:38 +02:00
|
|
|
timerBase={20000}
|
|
|
|
labelKey="disconnectPrompt"
|
|
|
|
infoTooltipLabelKey="disconnectAllAccountsConfirmationDescription"
|
|
|
|
warningTime="0:15"
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|