Skip to content

Commit

Permalink
Merge pull request #903 from CodeForAfrica/chore/techlogblog_mdxjs
Browse files Browse the repository at this point in the history
@/techlabblog mdxjs
  • Loading branch information
kilemensi authored Oct 1, 2024
2 parents 30aea2d + 888dae6 commit 678225b
Show file tree
Hide file tree
Showing 37 changed files with 4,816 additions and 5,348 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ exports[`<Articles /> renders unchanged 1`] = `
class="MuiGrid-root MuiGrid-item MuiGrid-grid-md-auto css-11ydr13-MuiGrid-root"
>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary css-a46zki-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary css-a46zki-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
>
<div
aria-controls=":r0:"
Expand Down
1 change: 0 additions & 1 deletion apps/civicsignalblog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"dotenv": "catalog:",
"express": "catalog:",
"fast-equals": "catalog:",
"gray-matter": "catalog:",
"js-yaml": "catalog:",
"jsdom": "catalog:",
"next": "catalog:",
Expand Down
1 change: 0 additions & 1 deletion apps/codeforafrica/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"dotenv": "catalog:",
"express": "catalog:",
"fast-equals": "catalog:",
"gray-matter": "catalog:",
"js-yaml": "catalog:",
"jsdom": "catalog:",
"next": "catalog:",
Expand Down
26 changes: 20 additions & 6 deletions apps/techlabblog/app/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import { Box } from "@mui/material";
import { Section } from "@commons-ui/core";

import Article from "@/techlabblog/components/Article";
import { ArticleProps, getContent } from "@/techlabblog/lib/data";
import PostHeader from "@/techlabblog/components/PostHeader";
import { getPost } from "@/techlabblog/lib/data";

export default async function Page({ params }: { params: { slug: string } }) {
const post: ArticleProps = await getContent(params.slug);
const postModule = await getPost(params.slug);

// TODO: Check that the post does exist, return 404 otherwise
return <Article {...post} />;
if (!(postModule && postModule.frontmatter)) {
// TODO(kilemensi): 404
return null;
}
const { default: PostContent, frontmatter } = postModule;
return (
<Section
sx={{
px: { xs: 2.5, sm: 0 },
py: { xs: 2.5, sm: 5 },
}}
>
<PostHeader {...frontmatter} />
<PostContent />
</Section>
);
}
13 changes: 9 additions & 4 deletions apps/techlabblog/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ export default async function RootLayout({
}: Readonly<{
children: React.ReactNode;
}>) {
const settings = await getSettings();
if (!settings) {
// TODO(kilemensi): log to sentry
return null;
}
const { analytics, connect, primaryNavigation, secondaryNavigation } =
await getSettings();
// TODO: blurWidth/blurHeight https://github.com/vercel/next.js/issues/56511
settings;
// TODO(kilemensi): blurWidth/blurHeight https://github.com/vercel/next.js/issues/56511
const { blurWidth, blurHeight, ...logoProps } = logoLight;
const logo = {
...logoProps,
Expand All @@ -39,9 +44,9 @@ export default async function RootLayout({
<NavBar {...primaryNavigation} logo={logo} />
{children}
<Footer
copyright={secondaryNavigation.copyright}
connect={connect}
secondaryMenus={secondaryNavigation.menus}
copyright={secondaryNavigation?.copyright}
secondaryMenus={secondaryNavigation?.menus}
/>
</ThemeProvider>
</AppRouterCacheProvider>
Expand Down
12 changes: 7 additions & 5 deletions apps/techlabblog/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Section } from "@commons-ui/core";

import ArticleList from "@/techlabblog/components/ArticleList";
import { getAllContents } from "@/techlabblog/lib/data";
import PostList from "@/techlabblog/components/PostList";
import { getPosts } from "@/techlabblog/lib/data";

export default async function index() {
const posts = await getAllContents();
async function Page() {
const posts = await getPosts();

return (
<Section
Expand All @@ -13,7 +13,9 @@ export default async function index() {
py: { xs: 2.5, sm: 5 },
}}
>
<ArticleList articles={posts} />
<PostList posts={posts} />
</Section>
);
}

export default Page;
40 changes: 0 additions & 40 deletions apps/techlabblog/components/Article/Article.tsx

This file was deleted.

49 changes: 0 additions & 49 deletions apps/techlabblog/components/Article/ArticleHeader.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions apps/techlabblog/components/Article/ArticleSxProps.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions apps/techlabblog/components/Article/index.ts

This file was deleted.

38 changes: 0 additions & 38 deletions apps/techlabblog/components/ArticleList/ArticleList.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions apps/techlabblog/components/ArticleList/index.ts

This file was deleted.

48 changes: 0 additions & 48 deletions apps/techlabblog/components/Markdown/CopyCodeButton.tsx

This file was deleted.

Loading

0 comments on commit 678225b

Please sign in to comment.