// Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React, { useEffect, useState } from 'react'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; import type { Loadable } from '../../util/loadable'; import { LoadingState } from '../../util/loadable'; import { InstallScreenQrCodeNotScannedStep } from './InstallScreenQrCodeNotScannedStep'; const i18n = setupI18n('en', enMessages); export default { title: 'Components/InstallScreen/InstallScreenQrCodeNotScannedStep', }; function Simulation({ finalResult }: { finalResult: Loadable }) { const [provisioningUrl, setProvisioningUrl] = useState>({ loadingState: LoadingState.Loading, }); useEffect(() => { const timeout = setTimeout(() => { setProvisioningUrl(finalResult); }, 2000); return () => { clearTimeout(timeout); }; }, [finalResult]); return ( ); } export function QrCodeLoading(): JSX.Element { return ( ); } QrCodeLoading.story = { name: 'QR code loading', }; export function QrCodeFailedToLoad(): JSX.Element { return ( ); } QrCodeFailedToLoad.story = { name: 'QR code failed to load', }; export function QrCodeLoaded(): JSX.Element { return ( ); } QrCodeLoaded.story = { name: 'QR code loaded', }; export function SimulatedLoading(): JSX.Element { return ( ); } SimulatedLoading.story = { name: 'Simulated loading', }; export function SimulatedFailure(): JSX.Element { return ( ); } SimulatedFailure.story = { name: 'Simulated failure', };