-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #880 from CodeForAfrica/fix/commons_ui_core_client
Mark @/commons-ui/core components as client only for now
- Loading branch information
Showing
20 changed files
with
175 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import { ArticleContent } from "@/engineeringblog/components/Article"; | ||
import { Box } from "@mui/material"; | ||
import { getContent } from "@/engineeringblog/utils"; | ||
|
||
import Article from "@/engineeringblog/components/Article"; | ||
import { ArticleProps, getContent } from "@/engineeringblog/utils"; | ||
|
||
export default async function Page({ params }: { params: { slug: string } }) { | ||
const post = await getContent(params.slug); | ||
return ( | ||
<Box component="article"> | ||
<ArticleContent article={post} /> | ||
</Box> | ||
); | ||
const post: ArticleProps = await getContent(params.slug); | ||
|
||
// TODO: Check that the post does exist, return 404 otherwise | ||
return <Article {...post} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
import { Container } from "@mui/material"; | ||
import { ArticleList } from "@/engineeringblog/components/Article"; | ||
import { Section } from "@commons-ui/core"; | ||
|
||
import ArticleList from "@/engineeringblog/components/ArticleList"; | ||
import { getAllContents } from "@/engineeringblog/utils"; | ||
import NoPosts from "@/engineeringblog/components/NoPosts"; | ||
|
||
export default async function index() { | ||
const posts = await getAllContents(); | ||
|
||
if (!posts.length) { | ||
return <NoPosts />; | ||
} | ||
|
||
return ( | ||
<Container | ||
<Section | ||
sx={{ | ||
px: { xs: 2.5, sm: 0 }, | ||
py: { xs: 2.5, sm: 5 }, | ||
}} | ||
> | ||
<ArticleList articles={posts} /> | ||
</Container> | ||
</Section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"use client"; | ||
|
||
import { Section } from "@commons-ui/core"; | ||
import React from "react"; | ||
|
||
import Markdown from "@/engineeringblog/components/Markdown"; | ||
import type { ArticleSxProps } from "./ArticleSxProps"; | ||
import ArticleHeader from "./ArticleHeader"; | ||
|
||
const Article = React.forwardRef(function Article( | ||
props: ArticleSxProps, | ||
ref: React.Ref<HTMLDivElement>, | ||
) { | ||
const { content, excerpt, publishedDate, sx, title } = props; | ||
|
||
return ( | ||
<Section | ||
component="article" | ||
sx={{ | ||
px: { xs: 2.5, sm: 0 }, | ||
py: 2.5, | ||
maxWidth: { | ||
sm: "648px", | ||
md: "912px", | ||
}, | ||
...sx, | ||
}} | ||
ref={ref} | ||
> | ||
<ArticleHeader | ||
excerpt={excerpt} | ||
publishedDate={publishedDate} | ||
title={title} | ||
/> | ||
<Markdown markdown={content} /> | ||
</Section> | ||
); | ||
}); | ||
|
||
export default Article; |
40 changes: 0 additions & 40 deletions
40
apps/engineeringblog/components/Article/ArticleContent.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { SxProps } from "@mui/material/styles"; | ||
|
||
import { ArticleProps } from "@/engineeringblog/utils"; | ||
|
||
interface ArticleSxProps extends ArticleProps { | ||
sx?: SxProps; | ||
} | ||
|
||
export type { ArticleSxProps }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import ArticleList from "./ArticleList"; | ||
import ArticleCard from "./ArticleCard"; | ||
import ArticleContent from "./ArticleContent"; | ||
import Article from "./Article"; | ||
import ArticleHeader from "./ArticleHeader"; | ||
|
||
export { ArticleList, ArticleCard, ArticleContent }; | ||
export { ArticleHeader }; | ||
export default Article; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import ArticleCard from "./ArticleCard"; | ||
import ArticleList from "./ArticleList"; | ||
|
||
export { ArticleCard }; | ||
export default ArticleList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.