Skip to content

Commit

Permalink
Merge pull request #9 from nek0meshi/styled-components
Browse files Browse the repository at this point in the history
Styled components
  • Loading branch information
nek0meshi committed Jul 9, 2023
2 parents f099e29 + 367d574 commit 7715f89
Show file tree
Hide file tree
Showing 10 changed files with 908 additions and 38 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
* https://github.com/vercel/next.js/tree/canary/examples/blog-starter
* Render Markdown
* https://nextjs.org/learn/basics/dynamic-routes/render-markdown
* "Prop `className` did not match."への対処
* https://zenn.dev/nbr41to/articles/c0c691653e3d55
4 changes: 4 additions & 0 deletions frontend/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["next/babel"],
"plugins": ["babel-plugin-styled-components"]
}
11 changes: 0 additions & 11 deletions frontend/components/ArticleContent.module.scss

This file was deleted.

18 changes: 15 additions & 3 deletions frontend/components/ArticleContent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import styled from 'styled-components'
import dayjs from '@/lib/dayjs'
import styles from './ArticleContent.module.scss'

const Article = styled.article`
h1 {
font-size: 2em;
}
h2 {
font-size: 1.5em;
}
h3 {
font-size: 1.2em;
}
`

type Props = {
content: string
Expand All @@ -9,11 +21,11 @@ type Props = {

const ArticleContent = ({ content, title, date }: Props) => {
return (
<article className={styles.ArticleContent}>
<Article>
<small>{date.format('YYYY-MM-DD')}</small>
<h1>{title}</h1>
<div dangerouslySetInnerHTML={{ __html: content }} />
</article>
</Article>
)
}

Expand Down

0 comments on commit 7715f89

Please sign in to comment.