Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: website aside remount #1846

Merged
merged 2 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import './src/styles/index.css';

export { wrapRootElement } from './gatsby-shared';
export { wrapRootElement, wrapPageElement } from './gatsby-shared';
5 changes: 5 additions & 0 deletions website/gatsby-shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { countAtom, menuAtom, searchAtom, textAtom } from './src/atoms';
import { Code } from './src/components/code';
import { CodeSandbox } from './src/components/code-sandbox';
import { InlineCode } from './src/components/inline-code';
import { Layout } from './src/components/layout';
import { A, H2, H3, H4, H5 } from './src/components/mdx';
import { Stackblitz } from './src/components/stackblitz';
import { TOC } from './src/components/toc';
Expand Down Expand Up @@ -33,3 +34,7 @@ export const wrapRootElement = ({ element }) => (
<MDXProvider components={components}>{element}</MDXProvider>
</JotaiProvider>
);

export const wrapPageElement = ({ element, props }) => {
return <Layout showDocs={props.path.startsWith('/docs')}>{element}</Layout>;
};
2 changes: 1 addition & 1 deletion website/gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { wrapRootElement } from './gatsby-shared';
export { wrapRootElement, wrapPageElement } from './gatsby-shared';

export const onRenderBody = ({ setHtmlAttributes, setPreBodyComponents }) => {
setHtmlAttributes({ lang: 'en' });
Expand Down
5 changes: 2 additions & 3 deletions website/src/pages/docs/{Mdx.slug}.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { graphql } from 'gatsby';
import { MDXRenderer } from 'gatsby-plugin-mdx';
import { Jotai } from '../../components/jotai';
import { Layout } from '../../components/layout';
import { Meta } from '../../components/meta';

export default function DocsPage({ data }) {
const { frontmatter, body } = data.mdx;
const { title } = frontmatter;

return (
<Layout showDocs>
<>
<div className="mb-4 lg:hidden">
<Jotai isDocsPage small />
</div>
<h1>{title}</h1>
<MDXRenderer>{body}</MDXRenderer>
</Layout>
</>
);
}

Expand Down
5 changes: 2 additions & 3 deletions website/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import { Headline } from '../components/headline';
import { InlineCode } from '../components/inline-code';
import { IntegrationsDemo } from '../components/integrations-demo';
import { Intro } from '../components/intro';
import { Layout } from '../components/layout';
import { LogoCloud } from '../components/logo-cloud';
import { Meta } from '../components/meta';
import { Tabs } from '../components/tabs';
import { UtilitiesDemo } from '../components/utilities-demo';

export default function HomePage() {
return (
<Layout>
<>
<Intro />
<div className="mt-12 space-y-12 lg:mt-24 lg:space-y-24">
<div className="space-y-4">
Expand Down Expand Up @@ -65,7 +64,7 @@ export default function HomePage() {
</a>
</div>
</div>
</Layout>
</>
);
}

Expand Down