import { useStore } from '@nanostores/preact'; import SpinnerIcon from '../icons/spinner.svg'; import { pageProgressMessage } from '../stores/page'; import { useEffect, useState } from 'preact/hooks'; export interface Props { initialMessage: string; } export function PageProgress(props: Props) { const { initialMessage } = props; const [message, setMessage] = useState(initialMessage); const $pageProgressMessage = useStore(pageProgressMessage); useEffect(() => { setMessage($pageProgressMessage); }, [$pageProgressMessage]); if (!message) { return null; } return (
{/* Tailwind based spinner for full page */}
Loading

{message} ...

); }