forked from boxyhq/saas-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
101 lines (93 loc) · 2.99 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import Link from 'next/link';
import { type ReactElement } from 'react';
import { useTranslation } from 'next-i18next';
import type { NextPageWithLayout } from 'types';
import { GetServerSidePropsContext } from 'next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import FAQSection from '@/components/defaultLanding/FAQSection';
import HeroSection from '@/components/defaultLanding/HeroSection';
import FeatureSection from '@/components/defaultLanding/FeatureSection';
import PricingSection from '@/components/defaultLanding/PricingSection';
import useTheme from 'hooks/useTheme';
import env from '@/lib/env';
import Head from 'next/head';
const Home: NextPageWithLayout = () => {
const { toggleTheme, selectedTheme } = useTheme();
const { t } = useTranslation('common');
return (
<>
<Head>
<title>{t('homepage-title')}</title>
</Head>
<div className="container mx-auto">
<div className="navbar bg-base-100 px-0 sm:px-1">
<div className="flex-1">
<Link href="/" className="btn btn-ghost text-xl normal-case">
BoxyHQ
</Link>
</div>
<div className="flex-none">
<ul className="menu menu-horizontal flex items-center gap-2 sm:gap-4">
{env.darkModeEnabled && (
<li>
<button
className="bg-none p-0 rounded-lg flex items-center justify-center"
onClick={toggleTheme}
>
<selectedTheme.icon className="w-5 h-5" />
</button>
</li>
)}
<li>
<Link
href="/auth/join"
className="btn btn-primary btn-md py-3 px-2 sm:px-4 text-white"
>
{t('sign-up')}
</Link>
</li>
<li>
<Link
href="/auth/login"
className="btn btn-primary dark:border-zinc-600 dark:border-2 dark:text-zinc-200 btn-outline py-3 px-2 sm:px-4 btn-md"
>
{t('sign-in')}
</Link>
</li>
</ul>
</div>
</div>
<HeroSection />
<div className="divider"></div>
<FeatureSection />
<div className="divider"></div>
<PricingSection />
<div className="divider"></div>
<FAQSection />
</div>
</>
);
};
export const getServerSideProps = async (
context: GetServerSidePropsContext
) => {
// Redirect to login page if landing page is disabled
if (env.hideLandingPage) {
return {
redirect: {
destination: '/auth/login',
permanent: true,
},
};
}
const { locale } = context;
return {
props: {
...(locale ? await serverSideTranslations(locale, ['common']) : {}),
},
};
};
Home.getLayout = function getLayout(page: ReactElement) {
return <>{page}</>;
};
export default Home;