Use DurationInSeconds for expireTimer
This commit is contained in:
parent
cf57c7aaf0
commit
6be69a7ba8
59 changed files with 411 additions and 216 deletions
|
@ -2,10 +2,10 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as React from 'react';
|
||||
import * as moment from 'moment';
|
||||
import { boolean, number, select, text } from '@storybook/addon-knobs';
|
||||
|
||||
import { setupI18n } from '../../util/setupI18n';
|
||||
import { DurationInSeconds } from '../../util/durations';
|
||||
import enMessages from '../../../_locales/en/messages.json';
|
||||
import type { Props } from './TimerNotification';
|
||||
import { TimerNotification } from './TimerNotification';
|
||||
|
@ -34,16 +34,19 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
|||
}
|
||||
: {
|
||||
disabled: false,
|
||||
expireTimer: number(
|
||||
'expireTimer',
|
||||
('expireTimer' in overrideProps ? overrideProps.expireTimer : 0) || 0
|
||||
expireTimer: DurationInSeconds.fromMillis(
|
||||
number(
|
||||
'expireTimer',
|
||||
('expireTimer' in overrideProps ? overrideProps.expireTimer : 0) ||
|
||||
0
|
||||
)
|
||||
),
|
||||
}),
|
||||
});
|
||||
|
||||
export const SetByOther = (): JSX.Element => {
|
||||
const props = createProps({
|
||||
expireTimer: moment.duration(1, 'hour').asSeconds(),
|
||||
expireTimer: DurationInSeconds.fromHours(1),
|
||||
type: 'fromOther',
|
||||
title: 'Mr. Fire',
|
||||
});
|
||||
|
@ -61,7 +64,7 @@ export const SetByOtherWithALongName = (): JSX.Element => {
|
|||
const longName = '🦴🧩📴'.repeat(50);
|
||||
|
||||
const props = createProps({
|
||||
expireTimer: moment.duration(1, 'hour').asSeconds(),
|
||||
expireTimer: DurationInSeconds.fromHours(1),
|
||||
type: 'fromOther',
|
||||
title: longName,
|
||||
});
|
||||
|
@ -81,7 +84,7 @@ SetByOtherWithALongName.story = {
|
|||
|
||||
export const SetByYou = (): JSX.Element => {
|
||||
const props = createProps({
|
||||
expireTimer: moment.duration(1, 'hour').asSeconds(),
|
||||
expireTimer: DurationInSeconds.fromHours(1),
|
||||
type: 'fromMe',
|
||||
title: 'Mr. Fire',
|
||||
});
|
||||
|
@ -97,7 +100,7 @@ export const SetByYou = (): JSX.Element => {
|
|||
|
||||
export const SetBySync = (): JSX.Element => {
|
||||
const props = createProps({
|
||||
expireTimer: moment.duration(1, 'hour').asSeconds(),
|
||||
expireTimer: DurationInSeconds.fromHours(1),
|
||||
type: 'fromSync',
|
||||
title: 'Mr. Fire',
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue