// 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', }; const Simulation = ({ finalResult }: { finalResult: Loadable }) => { const [provisioningUrl, setProvisioningUrl] = useState>({ loadingState: LoadingState.Loading, }); useEffect(() => { const timeout = setTimeout(() => { setProvisioningUrl(finalResult); }, 2000); return () => { clearTimeout(timeout); }; }, [finalResult]); return ( ); }; export const QrCodeLoading = (): JSX.Element => ( ); QrCodeLoading.story = { name: 'QR code loading', }; export const QrCodeFailedToLoad = (): JSX.Element => ( ); QrCodeFailedToLoad.story = { name: 'QR code failed to load', }; export const QrCodeLoaded = (): JSX.Element => ( ); QrCodeLoaded.story = { name: 'QR code loaded', }; export const SimulatedLoading = (): JSX.Element => ( ); SimulatedLoading.story = { name: 'Simulated loading', }; export const SimulatedFailure = (): JSX.Element => ( ); SimulatedFailure.story = { name: 'Simulated failure', };