webapp/src/pages/expo/expo.page.tsx

56 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-10-10 15:38:02 +00:00
import type { PageProps } from '../types'
import { createEffect, createMemo, on } from 'solid-js'
import { PageLayout } from '../../components/_shared/PageLayout'
2023-10-10 15:38:02 +00:00
import { Topics } from '../../components/Nav/Topics'
import { Expo } from '../../components/Views/Expo'
import { useLocalize } from '../../context/localize'
import { useRouter } from '../../stores/router'
import { LayoutType } from '../types'
2023-10-10 15:38:02 +00:00
export const ExpoPage = (props: PageProps) => {
const { t } = useLocalize()
const { page } = useRouter()
2024-02-04 09:30:06 +00:00
const getLayout = createMemo<LayoutType>(() => page().params['layout'] as LayoutType)
const getTitle = () => {
2023-10-10 15:38:02 +00:00
switch (getLayout()) {
2023-11-28 13:18:25 +00:00
case 'audio': {
2023-10-10 15:38:02 +00:00
return t('Audio')
}
case 'video': {
return t('Video')
}
case 'image': {
return t('Artworks')
}
case 'literature': {
return t('Literature')
}
default: {
return t('Art')
}
}
}
createEffect(
on(
() => getLayout(),
() => {
document.title = getTitle()
},
{ defer: true },
),
)
2023-10-10 15:38:02 +00:00
return (
<PageLayout withPadding={true} zeroBottomPadding={true} title={getTitle()}>
2023-10-10 15:38:02 +00:00
<Topics />
<Expo shouts={props.expoShouts} layout={getLayout()} />
2023-10-10 15:38:02 +00:00
</PageLayout>
)
}
export const Page = ExpoPage