webapp/src/components/Pages/AllAuthorsPage.tsx

31 lines
774 B
TypeScript
Raw Normal View History

2022-11-14 17:41:05 +00:00
import { PageWrap } from '../_shared/PageWrap'
2022-09-22 09:37:49 +00:00
import { AllAuthorsView } from '../Views/AllAuthors'
import type { PageProps } from '../types'
2022-11-15 09:38:12 +00:00
import { createSignal, onMount, Show } from 'solid-js'
import { loadAllAuthors } from '../../stores/zine/authors'
import { Loading } from '../Loading'
2022-09-22 09:37:49 +00:00
export const AllAuthorsPage = (props: PageProps) => {
2022-11-15 09:38:12 +00:00
const [isLoaded, setIsLoaded] = createSignal<boolean>(Boolean(props.allAuthors))
onMount(async () => {
if (isLoaded()) {
return
}
await loadAllAuthors()
setIsLoaded(true)
})
2022-09-22 09:37:49 +00:00
return (
<PageWrap>
2022-11-15 09:38:12 +00:00
<Show when={isLoaded()} fallback={<Loading />}>
2022-10-05 15:11:14 +00:00
<AllAuthorsView authors={props.allAuthors} />
2022-11-15 09:38:12 +00:00
</Show>
</PageWrap>
2022-09-22 09:37:49 +00:00
)
}
// for lazy loading
export default AllAuthorsPage