import { useRef } from 'react'; import { Meta, StoryObj } from '@storybook/react'; import { Button, Flex } from '../../components'; import { useTopLoading } from '.'; const meta: Meta = { title: 'Hooks/useTopLoading', parameters: { layout: 'centered', }, }; export default meta; type Story = StoryObj; function Template() { const { finish: finishLoading, start: startLoading, setProgress } = useTopLoading(); const timer = useRef(); const startAndFinishLoading = () => { startLoading(); clearTimeout(timer.current); timer.current = setTimeout(() => { finishLoading(); }, 1000); }; return ( ); } export const Primary: Story = { render: Template, };