Skip to content

Commit

Permalink
feat: add routing
Browse files Browse the repository at this point in the history
  • Loading branch information
umidullo committed Aug 22, 2023
1 parent 0b315cc commit 8fea3ed
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 4 deletions.
5 changes: 4 additions & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { appWithTranslation } from 'next-i18next';
import Router from 'next/router';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import Layout from '@/components/layout';

NProgress.configure({ showSpinner: false });

Expand Down Expand Up @@ -39,7 +40,9 @@ function App({ Component, pageProps }: AppProps) {
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" />
</Head>
<Component {...pageProps} />
<Layout>
<Component {...pageProps} />
</Layout>
</>
);
}
Expand Down
5 changes: 2 additions & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Clients from '@/components/clients';
import Layout from '@/components/layout';
import Portfolio from '@/components/portfolio';
import Promo from '@/components/promo';
import Services from '@/components/services';
Expand All @@ -22,11 +21,11 @@ export default function Home({
posts,
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
return (
<Layout>
<>
<Promo />
<Services />
<Portfolio posts={posts} />
<Clients />
</Layout>
</>
);
}
15 changes: 15 additions & 0 deletions pages/info/about.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Magic from '@/components/magic';
import { getStaticPropsTranslations } from '@/utils/helpers/i18n';
import { GetServerSideProps } from 'next';

export const getServerSideProps: GetServerSideProps = async (context) => {
return {
props: {
...(await getStaticPropsTranslations(context.locale ?? 'ru')),
},
};
};

export default function Page() {
return <Magic />;
}
15 changes: 15 additions & 0 deletions pages/info/career.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Magic from '@/components/magic';
import { getStaticPropsTranslations } from '@/utils/helpers/i18n';
import { GetServerSideProps } from 'next';

export const getServerSideProps: GetServerSideProps = async (context) => {
return {
props: {
...(await getStaticPropsTranslations(context.locale ?? 'ru')),
},
};
};

export default function Page() {
return <Magic />;
}
15 changes: 15 additions & 0 deletions pages/info/contacts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Magic from '@/components/magic';
import { getStaticPropsTranslations } from '@/utils/helpers/i18n';
import { GetServerSideProps } from 'next';

export const getServerSideProps: GetServerSideProps = async (context) => {
return {
props: {
...(await getStaticPropsTranslations(context.locale ?? 'ru')),
},
};
};

export default function Page() {
return <Magic />;
}
27 changes: 27 additions & 0 deletions pages/portfolio/[slug].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Magic from '@/components/magic';
import { getStaticPropsTranslations } from '@/utils/helpers/i18n';
import { GetServerSideProps } from 'next';

export const getServerSideProps: GetServerSideProps = async (context) => {
if (!context.params)
return {
notFound: true,
};

// const data = await fetchData(`/menu/${context.params.slug}`, context.locale);
// if (!data) {
// return {
// notFound: true,
// };
// }

return {
props: {
...(await getStaticPropsTranslations(context.locale ?? 'ru')),
},
};
};

export default function Page() {
return <Magic />;
}
15 changes: 15 additions & 0 deletions pages/portfolio/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Magic from '@/components/magic';
import { getStaticPropsTranslations } from '@/utils/helpers/i18n';
import { GetServerSideProps } from 'next';

export const getServerSideProps: GetServerSideProps = async (context) => {
return {
props: {
...(await getStaticPropsTranslations(context.locale ?? 'ru')),
},
};
};

export default function Page() {
return <Magic />;
}
27 changes: 27 additions & 0 deletions pages/services/[slug].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Magic from '@/components/magic';
import { getStaticPropsTranslations } from '@/utils/helpers/i18n';
import { GetServerSideProps } from 'next';

export const getServerSideProps: GetServerSideProps = async (context) => {
if (!context.params)
return {
notFound: true,
};

// const data = await fetchData(`/menu/${context.params.slug}`, context.locale);
// if (!data) {
// return {
// notFound: true,
// };
// }

return {
props: {
...(await getStaticPropsTranslations(context.locale ?? 'ru')),
},
};
};

export default function Page() {
return <Magic />;
}
15 changes: 15 additions & 0 deletions pages/services/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Magic from '@/components/magic';
import { getStaticPropsTranslations } from '@/utils/helpers/i18n';
import { GetServerSideProps } from 'next';

export const getServerSideProps: GetServerSideProps = async (context) => {
return {
props: {
...(await getStaticPropsTranslations(context.locale ?? 'ru')),
},
};
};

export default function Page() {
return <Magic />;
}

0 comments on commit 8fea3ed

Please sign in to comment.