2021-06-25 23:52:56 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
|
|
|
import { DisappearingTimerSelect } from './DisappearingTimerSelect';
|
2021-09-18 00:30:08 +00:00
|
|
|
import { setupI18n } from '../util/setupI18n';
|
2021-06-25 23:52:56 +00:00
|
|
|
import enMessages from '../../_locales/en/messages.json';
|
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export default {
|
|
|
|
title: 'Components/DisappearingTimerSelect',
|
|
|
|
};
|
2021-06-25 23:52:56 +00:00
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
initialValue: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
const TimerSelectWrap: React.FC<Props> = ({ initialValue }) => {
|
|
|
|
const [value, setValue] = useState(initialValue);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<DisappearingTimerSelect
|
|
|
|
i18n={i18n}
|
|
|
|
value={value}
|
|
|
|
onChange={newValue => setValue(newValue)}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export const InitialValue1Day = (): JSX.Element => (
|
2021-06-25 23:52:56 +00:00
|
|
|
<TimerSelectWrap initialValue={24 * 3600} />
|
2022-06-07 00:48:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
InitialValue1Day.story = {
|
|
|
|
name: 'Initial value: 1 day',
|
|
|
|
};
|
2021-06-25 23:52:56 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export const InitialValue3DaysCustomTime = (): JSX.Element => (
|
2021-06-25 23:52:56 +00:00
|
|
|
<TimerSelectWrap initialValue={3 * 24 * 3600} />
|
2022-06-07 00:48:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
InitialValue3DaysCustomTime.story = {
|
|
|
|
name: 'Initial value 3 days (Custom time)',
|
|
|
|
};
|