1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-01 13:47:06 +01:00
metamask-extension/ui/app/pages/swaps/countdown-timer/countdown-timer.stories.js
Erik Marks 76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00

64 lines
1.4 KiB
JavaScript

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