You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
64 lines
1.4 KiB
4 years ago
|
import React from 'react';
|
||
|
import { number } from '@storybook/addon-knobs';
|
||
|
import CountdownTimer from './countdown-timer';
|
||
4 years ago
|
|
||
|
export default {
|
||
|
title: 'CountdownTimer',
|
||
4 years ago
|
};
|
||
4 years ago
|
|
||
4 years ago
|
const getTimeStartedFromDecrimentSeconds = (seconds) =>
|
||
4 years ago
|
Date.now() - seconds * 1000;
|
||
4 years ago
|
|
||
|
export const Default = () => {
|
||
4 years ago
|
const timeStartedSecondDecriment = number(
|
||
|
'Set timeStarted to curren time minus X seconds',
|
||
|
10,
|
||
4 years ago
|
);
|
||
4 years ago
|
|
||
|
return (
|
||
|
<CountdownTimer
|
||
4 years ago
|
timeStarted={getTimeStartedFromDecrimentSeconds(
|
||
|
timeStartedSecondDecriment,
|
||
|
)}
|
||
4 years ago
|
timeOnly
|
||
|
/>
|
||
4 years ago
|
);
|
||
|
};
|
||
4 years ago
|
|
||
|
export const CustomTimerBase = () => {
|
||
4 years ago
|
const timeStartedSecondDecriment = number(
|
||
|
'Set timeStarted to curren time minus X seconds',
|
||
|
10,
|
||
4 years ago
|
);
|
||
4 years ago
|
|
||
|
return (
|
||
|
<CountdownTimer
|
||
4 years ago
|
timeStarted={getTimeStartedFromDecrimentSeconds(
|
||
|
timeStartedSecondDecriment,
|
||
|
)}
|
||
4 years ago
|
timerBase={150000}
|
||
|
timeOnly
|
||
|
/>
|
||
4 years ago
|
);
|
||
|
};
|
||
4 years ago
|
|
||
|
// Label keys used in below stories are just for demonstration purposes
|
||
|
export const WithLabelInfoTooltipAndWarning = () => {
|
||
4 years ago
|
const timeStartedSecondDecriment = number(
|
||
|
'Set timeStarted to curren time minus X seconds',
|
||
|
0,
|
||
4 years ago
|
);
|
||
4 years ago
|
|
||
|
return (
|
||
|
<CountdownTimer
|
||
4 years ago
|
timeStarted={getTimeStartedFromDecrimentSeconds(
|
||
|
timeStartedSecondDecriment,
|
||
|
)}
|
||
4 years ago
|
timerBase={20000}
|
||
|
labelKey="disconnectPrompt"
|
||
|
infoTooltipLabelKey="disconnectAllAccountsConfirmationDescription"
|
||
|
warningTime="0:15"
|
||
|
/>
|
||
4 years ago
|
);
|
||
|
};
|