From 12eaa741ab0b23abd21d887d5321e5831a0f2556 Mon Sep 17 00:00:00 2001 From: zyachel Date: Sun, 29 Oct 2023 00:11:28 +0530 Subject: [PATCH] refactor: general refactor make barrel files .ts instead of .tsx move layouts to components directory --- src/components/error/ErrorInfo.tsx | 3 +-- src/{layouts => components/layout}/Footer.tsx | 2 +- src/{layouts => components/layout}/Header.tsx | 0 src/{layouts/Layout.tsx => components/layout/index.tsx} | 0 src/components/name/{index.tsx => index.ts} | 0 src/components/title/{index.tsx => index.ts} | 0 src/pages/about/index.tsx | 2 +- src/pages/contact/index.tsx | 2 +- src/pages/find/index.tsx | 2 +- src/pages/name/[nameId]/index.tsx | 2 +- src/pages/privacy/index.tsx | 2 +- src/pages/title/[titleId]/index.tsx | 2 +- 12 files changed, 8 insertions(+), 9 deletions(-) rename src/{layouts => components/layout}/Footer.tsx (95%) rename src/{layouts => components/layout}/Header.tsx (100%) rename src/{layouts/Layout.tsx => components/layout/index.tsx} (100%) rename src/components/name/{index.tsx => index.ts} (100%) rename src/components/title/{index.tsx => index.ts} (100%) diff --git a/src/components/error/ErrorInfo.tsx b/src/components/error/ErrorInfo.tsx index 07cca5f..d2bc50d 100644 --- a/src/components/error/ErrorInfo.tsx +++ b/src/components/error/ErrorInfo.tsx @@ -1,6 +1,5 @@ -import { ReactNode } from 'react'; import Link from 'next/link'; -import Layout from 'src/layouts/Layout'; +import Layout from 'src/components/layout'; import Meta from 'src/components/meta/Meta'; import styles from 'src/styles/modules/components/error/error-info.module.scss'; diff --git a/src/layouts/Footer.tsx b/src/components/layout/Footer.tsx similarity index 95% rename from src/layouts/Footer.tsx rename to src/components/layout/Footer.tsx index 2db0f3f..95c4f84 100644 --- a/src/layouts/Footer.tsx +++ b/src/components/layout/Footer.tsx @@ -1,6 +1,6 @@ import Link from 'next/link'; import { useRouter } from 'next/router'; -import styles from '../styles/modules/layout/footer.module.scss'; +import styles from 'src/styles/modules/layout/footer.module.scss'; const links = [ { path: '/about', text: 'About' }, diff --git a/src/layouts/Header.tsx b/src/components/layout/Header.tsx similarity index 100% rename from src/layouts/Header.tsx rename to src/components/layout/Header.tsx diff --git a/src/layouts/Layout.tsx b/src/components/layout/index.tsx similarity index 100% rename from src/layouts/Layout.tsx rename to src/components/layout/index.tsx diff --git a/src/components/name/index.tsx b/src/components/name/index.ts similarity index 100% rename from src/components/name/index.tsx rename to src/components/name/index.ts diff --git a/src/components/title/index.tsx b/src/components/title/index.ts similarity index 100% rename from src/components/title/index.tsx rename to src/components/title/index.ts diff --git a/src/pages/about/index.tsx b/src/pages/about/index.tsx index 29b446e..ad1dd70 100644 --- a/src/pages/about/index.tsx +++ b/src/pages/about/index.tsx @@ -1,6 +1,6 @@ import Link from 'next/link'; import Meta from 'src/components/meta/Meta'; -import Layout from 'src/layouts/Layout'; +import Layout from 'src/components/layout'; import styles from 'src/styles/modules/pages/about/about.module.scss'; const About = () => { diff --git a/src/pages/contact/index.tsx b/src/pages/contact/index.tsx index 17db2f1..1ad05a2 100644 --- a/src/pages/contact/index.tsx +++ b/src/pages/contact/index.tsx @@ -1,5 +1,5 @@ import Meta from 'src/components/meta/Meta'; -import Layout from 'src/layouts/Layout'; +import Layout from 'src/components/layout'; import styles from 'src/styles/modules/pages/contact/contact.module.scss'; const Contact = () => { diff --git a/src/pages/find/index.tsx b/src/pages/find/index.tsx index cb63df5..e406b92 100644 --- a/src/pages/find/index.tsx +++ b/src/pages/find/index.tsx @@ -1,5 +1,5 @@ import { GetServerSideProps, InferGetServerSidePropsType } from 'next'; -import Layout from 'src/layouts/Layout'; +import Layout from 'src/components/layout'; import ErrorInfo from 'src/components/error/ErrorInfo'; import Meta from 'src/components/meta/Meta'; import Results from 'src/components/find'; diff --git a/src/pages/name/[nameId]/index.tsx b/src/pages/name/[nameId]/index.tsx index e3afcd5..fc7695d 100644 --- a/src/pages/name/[nameId]/index.tsx +++ b/src/pages/name/[nameId]/index.tsx @@ -1,6 +1,6 @@ import { GetServerSideProps, InferGetServerSidePropsType } from 'next'; import Meta from 'src/components/meta/Meta'; -import Layout from 'src/layouts/Layout'; +import Layout from 'src/components/layout'; import ErrorInfo from 'src/components/error/ErrorInfo'; import Media from 'src/components/media/Media'; import { Basic, Credits, DidYouKnow, Info, Bio, KnownFor } from 'src/components/name'; diff --git a/src/pages/privacy/index.tsx b/src/pages/privacy/index.tsx index 697178f..012baf4 100644 --- a/src/pages/privacy/index.tsx +++ b/src/pages/privacy/index.tsx @@ -1,5 +1,5 @@ import Meta from 'src/components/meta/Meta'; -import Layout from 'src/layouts/Layout'; +import Layout from 'src/components/layout'; import packageInfo from 'src/../package.json'; import styles from 'src/styles/modules/pages/privacy/privacy.module.scss'; diff --git a/src/pages/title/[titleId]/index.tsx b/src/pages/title/[titleId]/index.tsx index 3fab840..67ee92e 100644 --- a/src/pages/title/[titleId]/index.tsx +++ b/src/pages/title/[titleId]/index.tsx @@ -1,6 +1,6 @@ import { GetServerSideProps, InferGetServerSidePropsType } from 'next'; import Meta from 'src/components/meta/Meta'; -import Layout from 'src/layouts/Layout'; +import Layout from 'src/components/layout'; import ErrorInfo from 'src/components/error/ErrorInfo'; import Media from 'src/components/media/Media'; import { Basic, Cast, DidYouKnow, Info, MoreLikeThis, Reviews } from 'src/components/title';