Files
hudozka/pages/index.tsx
T
tmshv 9ee9bce197 Normalize interface naming — remove I prefix convention (#255)
* update pr workflow

* interface to types

* use consistent import

* import type syntax

* test plan note
2026-02-08 15:57:11 +07:00

92 lines
2.5 KiB
TypeScript

import Head from "next/head"
import { App } from "@/components/App"
import { NextSeo } from "next-seo"
import { PageGrid } from "@/components/PageGrid"
import { HudozkaTitle } from "@/components/HudozkaTitle"
import { MetaBuilder } from "@/lib/meta"
import type { GetStaticProps, NextPage } from "next"
import type { MenuItem, Meta, PageCardDto } from "@/types"
import { useMobile } from "@/hooks/useMobile"
import { getHomeCards, getMenu } from "@/remote/api"
type Props = {
title: string
meta: Meta
menu: MenuItem[]
items: PageCardDto[]
}
const Index: NextPage<Props> = props => {
const mobile = useMobile()
return (
<>
<NextSeo
title={props.meta.title}
description={props.meta.description}
canonical="https://art.shlisselburg.org/"
openGraph={{
url: props.meta.url,
title: props.meta.title,
description: props.meta.description,
images: [
{
url: props.meta.image,
width: props.meta.imageWidth,
height: props.meta.imageHeight,
alt: props.meta.description,
type: "image/jpeg",
},
],
site_name: props.meta.siteName,
}}
/>
<Head>
<title>{props.title}</title>
</Head>
<App
showAuthor={true}
menu={props.menu}
>
{mobile ? null : (
<HudozkaTitle
style={{
marginTop: "var(--size-m)",
marginBottom: "var(--size-m)",
}}
/>
)}
<PageGrid
items={props.items}
/>
</App>
</>
)
}
export const getStaticProps: GetStaticProps<Props> = async () => {
const items = await getHomeCards()
const menu = await getMenu()
const title = "Шлиссельбургская ДХШ"
const meta = (new MetaBuilder())
.setTitle(title)
.setData({
url: "/",
})
.build()
return {
props: {
items,
title,
meta,
menu,
},
revalidate: 30,
}
}
export default Index