1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 07:04:22 +00:00
festa/pages/index.tsx

64 lines
2 KiB
TypeScript
Raw Normal View History

2022-05-29 02:01:56 +00:00
import { NextPageContext } from 'next'
2022-05-25 14:20:22 +00:00
import { useTranslation } from 'next-i18next'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
2022-05-28 03:45:05 +00:00
import { LoginContext } from '../contexts/login';
import { useDefinedContext } from '../utils/definedContext';
import { FormLoginTelegram } from '../components/FormLoginTelegram';
2022-05-29 02:01:56 +00:00
2022-05-25 14:20:22 +00:00
export async function getStaticProps(context: NextPageContext) {
2022-05-28 03:45:05 +00:00
return {
props: {
...(await serverSideTranslations(context.locale ?? "it-IT", ["common"]))
}
}
2022-05-25 14:20:22 +00:00
}
2022-05-20 11:59:24 +00:00
2022-05-29 02:01:56 +00:00
export default function PageIndex() {
2022-05-28 03:45:05 +00:00
const { t } = useTranslation("common")
const [login, _] = useDefinedContext(LoginContext)
return (
2022-05-29 03:00:48 +00:00
<main id="page-index" className="page">
<hgroup className="hero-titles">
2022-05-29 02:01:56 +00:00
<h1>
{t("siteTitle")}
</h1>
2022-05-29 03:00:48 +00:00
<h2>
{t("siteSubtitle")}
</h2>
</hgroup>
{login ?
<div className="hero-action">
<label htmlFor="input-name">
2022-05-29 02:01:56 +00:00
<p>
{t("eventsInputDescriptionFirst")}
2022-05-29 02:01:56 +00:00
</p>
</label>
<form
className="form-event-create"
>
<input
id="input-name"
placeholder={t("eventsInputName")}
type="text"
2022-05-29 02:01:56 +00:00
/>
<input
id="input-submit"
type="submit"
aria-label={t("eventsInputSubmitLabel")}
value="→"
className="square-40 positive"
/>
</form>
</div>
:
<FormLoginTelegram
className="hero-action"
/>
2022-05-29 03:00:48 +00:00
}
</main>
)
2022-05-20 11:59:24 +00:00
}