Skip to content

Commit 7b9d5cd

Browse files
authored
Merge pull request #12960 from TylerAPfledderer/refactor/base-layout-to-DS
refactor(layouts): create story and update style for base layout
2 parents 1e502f8 + 7989e90 commit 7b9d5cd

File tree

6 files changed

+84
-27
lines changed

6 files changed

+84
-27
lines changed

.storybook/main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import type { StorybookConfig } from "@storybook/nextjs"
1515
*/
1616

1717
const config: StorybookConfig = {
18-
stories: ["../src/components/**/*.stories.{ts,tsx}"],
18+
stories: [
19+
"../src/components/**/*.stories.tsx",
20+
"../src/layouts/stories/*.stories.tsx",
21+
],
1922
addons: [
2023
"@storybook/addon-links",
2124
"@storybook/addon-essentials",

src/@chakra-ui/foundations/sizes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const container = {
2-
"2xl": "1440px",
2+
"2xl": "1536px",
33
}
44

55
const sizes = {

src/layouts/RootLayout.tsx renamed to src/layouts/BaseLayout.tsx

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ import { SkipLink } from "@/components/SkipLink"
1414
// import TranslationBannerLegal from "@/components/TranslationBannerLegal"
1515
// import { toPosixPath } from "@/lib/utils/relativePath"
1616
// import { DEFAULT_LOCALE } from "@/lib/constants"
17-
import { lightTheme as oldTheme } from "../theme"
1817

1918
const FeedbackWidget = dynamic(() => import("@/components/FeedbackWidget"), {
2019
ssr: false,
2120
})
2221

23-
export const RootLayout = ({
22+
export const BaseLayout = ({
2423
children,
2524
// contentIsOutdated,
2625
// contentNotTranslated,
@@ -49,27 +48,37 @@ export const RootLayout = ({
4948
// const originalPagePath = toPosixPath(join(DEFAULT_LOCALE, asPath))
5049

5150
return (
52-
<Container mx="auto" maxW={oldTheme.variables.maxPageWidth}>
51+
<>
52+
{/**
53+
* The Skip Link is positioned above the container to ensure it is not affecting the
54+
* layout on initial load.
55+
*/}
5356
<SkipLink />
57+
<Container maxW="container.2xl" marginInline="auto">
58+
<Nav />
59+
60+
{/* TODO: FIX TRANSLATION BANNER LOGIC FOR https://github.com/ethereum/ethereum-org-website/issues/11305 */}
61+
{/* <TranslationBanner
62+
shouldShow={shouldShowTranslationBanner}
63+
isPageContentEnglish={contentNotTranslated}
64+
originalPagePath={originalPagePath}
65+
/>
66+
67+
<TranslationBannerLegal
68+
shouldShow={shouldShowLegalTranslationBanner}
69+
originalPagePath={originalPagePath}
70+
/> */}
71+
72+
{children}
73+
74+
<Footer lastDeployLocaleTimestamp={lastDeployLocaleTimestamp} />
75+
</Container>
76+
{/**
77+
* The Feedback Widget is positioned below the container to ensure it is not affecting the
78+
* layout on initial load.
79+
*/}
5480

55-
<Nav />
56-
57-
{/* TODO: FIX TRANSLATION BANNER LOGIC FOR https://github.com/ethereum/ethereum-org-website/issues/11305 */}
58-
{/* <TranslationBanner
59-
shouldShow={shouldShowTranslationBanner}
60-
isPageContentEnglish={contentNotTranslated}
61-
originalPagePath={originalPagePath}
62-
/>
63-
64-
<TranslationBannerLegal
65-
shouldShow={shouldShowLegalTranslationBanner}
66-
originalPagePath={originalPagePath}
67-
/> */}
68-
69-
{children}
70-
71-
<Footer lastDeployLocaleTimestamp={lastDeployLocaleTimestamp} />
7281
<FeedbackWidget />
73-
</Container>
82+
</>
7483
)
7584
}

src/layouts/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
export * from "./BaseLayout"
12
export * from "./Docs"
23
export * from "./Roadmap"
3-
export * from "./RootLayout"
44
export * from "./Staking"
55
export * from "./Static"
66
export * from "./Tutorial"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { Center } from "@chakra-ui/react"
2+
import type { Meta, StoryObj } from "@storybook/react"
3+
4+
import { langViewportModes } from "../../../.storybook/modes"
5+
import { BaseLayout as BaseLayoutComponent } from "../BaseLayout"
6+
7+
const meta = {
8+
title: "Templates/BaseLayout",
9+
component: BaseLayoutComponent,
10+
parameters: {
11+
layout: "fullscreen",
12+
chromatic: {
13+
modes: {
14+
...langViewportModes,
15+
},
16+
},
17+
},
18+
argTypes: {
19+
children: {
20+
table: {
21+
disable: true,
22+
},
23+
},
24+
lastDeployLocaleTimestamp: {
25+
table: {
26+
disable: true,
27+
},
28+
},
29+
},
30+
} satisfies Meta<typeof BaseLayoutComponent>
31+
32+
export default meta
33+
34+
export const BaseLayout: StoryObj<typeof meta> = {
35+
args: {
36+
children: (
37+
<Center h="497px" border="2px dashed" borderColor="primary.base">
38+
Content Here
39+
</Center>
40+
),
41+
contentIsOutdated: false,
42+
contentNotTranslated: false,
43+
lastDeployLocaleTimestamp: "May 14, 2021",
44+
},
45+
}

src/pages/_app.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { AppPropsWithLayout } from "@/lib/types"
1313
import "../styles/global.css"
1414

1515
import { useLocaleDirection } from "@/hooks/useLocaleDirection"
16-
import { RootLayout } from "@/layouts/RootLayout"
16+
import { BaseLayout } from "@/layouts/BaseLayout"
1717
import { mono } from "@/lib/fonts"
1818

1919
const App = ({ Component, pageProps }: AppPropsWithLayout) => {
@@ -45,13 +45,13 @@ const App = ({ Component, pageProps }: AppPropsWithLayout) => {
4545
`}
4646
</style>
4747
<ChakraProvider theme={theme}>
48-
<RootLayout
48+
<BaseLayout
4949
contentIsOutdated={!!pageProps.frontmatter?.isOutdated}
5050
contentNotTranslated={pageProps.contentNotTranslated}
5151
lastDeployLocaleTimestamp={pageProps.lastDeployLocaleTimestamp}
5252
>
5353
{getLayout(<Component {...pageProps} />)}
54-
</RootLayout>
54+
</BaseLayout>
5555
</ChakraProvider>
5656
</>
5757
)

0 commit comments

Comments
 (0)