Skip to content

Commit

Permalink
refactor: review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
canerakdas committed Jan 16, 2024
1 parent 553a591 commit 010b259
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 34 deletions.
5 changes: 4 additions & 1 deletion components/withLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import BlogLayout from '@/layouts/New/Blog';
import CenteredLayout from '@/layouts/New/Centered';
import DefaultLayout from '@/layouts/New/Default';
import DocsLayout from '@/layouts/New/Docs';
import HomeLayout from '@/layouts/New/Home';
import LearnLayout from '@/layouts/New/Learn';
import PostLayout from '@/layouts/New/Post';
import { ENABLE_WEBSITE_REDESIGN } from '@/next.constants.mjs';
Expand All @@ -28,18 +29,20 @@ const legacyLayouts = {
'index.hbs': LegacyIndexLayout,
'learn.hbs': LegacyLearnLayout,
'page.hbs': LegacyDefaultLayout,
'home.hbs': LegacyDefaultLayout,
'centered.hbs': LegacyDefaultLayout,
} satisfies Record<LegacyLayouts, FC>;

/** all the currently available layouts from website redesign */
const redesignLayouts = {
'about.hbs': AboutLayout,
'docs.hbs': DocsLayout,
'centered.hbs': CenteredLayout,
'home.hbs': HomeLayout,
'learn.hbs': LearnLayout,
'page.hbs': DefaultLayout,
'blog-post.hbs': PostLayout,
'blog-category.hbs': BlogLayout,
'centered.hbs': CenteredLayout,
} satisfies Record<Layouts, FC>;

type WithLayout<L = Layouts | LegacyLayouts> = PropsWithChildren<{ layout: L }>;
Expand Down
22 changes: 22 additions & 0 deletions layouts/New/Home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { FC, PropsWithChildren } from 'react';

import WithFooter from '@/components/withFooter';
import WithNavBar from '@/components/withNavBar';

import styles from './layouts.module.css';

const HomeLayout: FC<PropsWithChildren> = ({ children }) => (
<>
<WithNavBar />

<div className={`${styles.centeredLayout} ${styles.homeLayout}`}>
<div className="glowingBackdrop" />

<main>{children}</main>
</div>

<WithFooter />
</>
);

export default HomeLayout;
70 changes: 41 additions & 29 deletions layouts/New/layouts.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,21 @@
@apply flex
w-full
items-center
justify-center
px-4
py-14
md:px-14
lg:px-28;
justify-center;

main {
@apply items-center
justify-center
gap-8
md:flex-row
md:gap-14
xl:gap-28
2xl:gap-32;
justify-center;

section {
&:nth-of-type(1) {
@apply flex
max-w-[500px]
max-w-xl
flex-[1_0]
flex-col
gap-8;
items-center
gap-2
text-center;

> div {
@apply flex
Expand All @@ -95,24 +88,9 @@
@apply text-base
md:text-lg;
}

small {
@apply text-center
text-sm
text-neutral-800
xs:text-xs
dark:text-neutral-400;
}
}
}

&:nth-of-type(1)[role='status'] {
@apply max-w-xl
items-center
gap-2
text-center;

[role='button'] {
> [role='button'] {
@apply mt-4
flex
items-center
Expand All @@ -123,6 +101,40 @@
}
}
}
}
}
}

.homeLayout {
@apply px-4
py-14
md:px-14
lg:px-28;

main {
@apply gap-8
md:flex-row
md:gap-14
xl:gap-28
2xl:gap-32;

section {
&:nth-of-type(1) {
@apply max-w-[500px]
items-baseline
gap-8
text-start;

> div {
small {
@apply text-center
text-sm
text-neutral-800
xs:text-xs
dark:text-neutral-400;
}
}
}

&:nth-of-type(2) {
@apply flex
Expand Down
2 changes: 1 addition & 1 deletion pages/en/new-design/404.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: 404

import { ArrowRightIcon } from '@heroicons/react/24/solid';

<section role='status'>
<section>
404

<h1 className="special">Page could not be found</h1>
Expand Down
2 changes: 1 addition & 1 deletion pages/en/new-design/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Run JavaScript Everywhere
layout: centered.hbs
layout: home.hbs
---

<section>
Expand Down
6 changes: 4 additions & 2 deletions types/layouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
export type Layouts =
| 'about.hbs'
| 'docs.hbs'
| 'centered.hbs'
| 'home.hbs'
| 'learn.hbs'
| 'page.hbs'
| 'blog-category.hbs'
| 'blog-post.hbs';
| 'blog-post.hbs'
| 'centered.hbs';

// @TODO: These are legacy layouts that are going to be replaced with the `nodejs/nodejs.dev` Layouts in the future
export type LegacyLayouts =
Expand All @@ -18,4 +19,5 @@ export type LegacyLayouts =
| 'docs.hbs'
| 'download.hbs'
| 'page.hbs'
| 'home.hbs'
| 'centered.hbs';

0 comments on commit 010b259

Please sign in to comment.