Skip to content

Commit

Permalink
タグコンポーネントの分離・フォント変更・その他スタイルの変更
Browse files Browse the repository at this point in the history
  • Loading branch information
nedew committed Dec 28, 2020
1 parent 72e59cf commit 4f9a659
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 20 deletions.
31 changes: 31 additions & 0 deletions articles/202012290656_75234_markdown-style-test.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "Mdxで書けるMarkdownのスタイル確認"
date: "2020-12-29-06-56"
tags: [mdx, markdown, blog]
---

これはテスト記事です
- これはテストのテキストです。
- これはThis is a pen;
- React compornent;
- Next.js

# これはテストです React Components - Next.js

`content`

# Code block
```js
console.log('test desu')
const test = getPostData()
```

```ts
import { parse, format } from 'date-fns'

export function formatDate(date: string) {
const fmt = parse(date, 'yyyy-MM-dd-HH-mm', new Date())
// return format(fmt, 'yyyy/MM/dd HH:mm')
return format(fmt, 'yyyy/MM/dd')
}
```
7 changes: 3 additions & 4 deletions components/ArticleList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Link from 'next/link'
import Tags from './Tags'
import TagsInArticleList from './TagsInArticleList'
import styles from './styles/articleList.module.scss'
import { formatDate } from '../lib/format'
import Articles from '../pages/articles'

export default function ArticleList(props: {
articles: {
Expand All @@ -25,8 +24,8 @@ export default function ArticleList(props: {
</Link>
<div className={styles.articleInfo}>
<div className={styles.date}>{formatDate(a.date)}</div>
<div className={styles.separation}> / </div>
<Tags tags={a.tags} />
<div className={styles.separation}>/</div>
<TagsInArticleList tags={a.tags} />
</div>
</div>
)
Expand Down
18 changes: 18 additions & 0 deletions components/TagsInArticleList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Link from 'next/link'
import styles from './styles/tagsInArticleList.module.scss'

export default function Tag(props: {
tags: string[]
}) {
return (
<div className={styles.articleTags}>
{props.tags.map((tag, index) => {
return (
<Link href={`/tags/${tag}`} key={index}>
<a className={styles.tag}>{tag}</a>
</Link>
)
})}
</div>
)
}
4 changes: 2 additions & 2 deletions components/styles/article.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
display: flex;
font-size: 19px;
font-weight: 500;
// font-weight: bold;
color: var(--color-light-text);
letter-spacing: 0.05rem;
align-items: center;
margin-bottom: 0.8rem;
font-family: -apple-system, "Segoe UI", sans-serif;
font-family: 'Roboto', -apple-system, "Segoe UI", sans-serif;
@media screen and (max-width: $breakPoint) {
font-size: 17px;
// font-weight: 400;
Expand All @@ -47,7 +48,6 @@
}

.date {
font-family: -apple-system, "Segoe UI", sans-serif;
}

.article {
Expand Down
4 changes: 3 additions & 1 deletion components/styles/articleList.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@
.date {
display: inline-block;
font-size: 16px;
font-weight: 500;
letter-spacing: 0.05rem;
color: var(--color-light-text);
font-family: -apple-system, BlinkMacSystemFont, sans-serif, "Helvetica Neue", "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "ヒラギノ角ゴ ProN W3", Arial, メイリオ, Meiryo;
font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif, "Helvetica Neue", "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "ヒラギノ角ゴ ProN W3", Arial, メイリオ, Meiryo;
// font-weight: 600;
// margin-bottom: 0.2rem;
@media screen and (max-width: $breakPoint) {
Expand Down
6 changes: 4 additions & 2 deletions components/styles/footer.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
width: 100%;
// background-color: #fafafa;
// color: #bbbbbb;
font-family: 'Roboto', 'Segoe UI', 'Helvetica Neue', Arial, 'BIZ UDPGothic', 'Yu Gothic UI', 'Meiryo UI', Helvetica, sans-serif;
font-weight: 400;
padding: 1.8rem 0;
border-top: 1px solid var(--color-line);
margin-top: auto;
Expand Down Expand Up @@ -46,7 +48,7 @@
}

@media screen and (max-width: $breakPoint) {
font-size: 16px;
font-size: 15px;
margin-bottom: .9rem;
order: inherit;
}
Expand All @@ -57,7 +59,7 @@
margin-right: 1rem;
order: 1;
@media screen and (max-width: $breakPoint) {
font-size: 16px;
font-size: 15px;
order: inherit;
}
}
2 changes: 1 addition & 1 deletion components/styles/header.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
text-decoration: none;
font-size: 30px;
font-size: 35px;
font-weight: 700;
font-weight: 900;
user-select: none;
@media screen and (max-width: $breakPoint) {
font-size: 25px;
Expand Down
4 changes: 2 additions & 2 deletions components/styles/tag.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
margin-bottom: .5rem;
border-radius: 4px;
text-decoration: none;
// font-weight: 600;
font-size: 19px;
font-family: 'Segoe UI', 'Helvetica Neue', Arial, 'BIZ UDPGothic', 'Yu Gothic UI', 'Meiryo UI', Helvetica, sans-serif;
font-family: 'Roboto', 'Segoe UI', 'Helvetica Neue', Arial, 'BIZ UDPGothic', 'Yu Gothic UI', 'Meiryo UI', Helvetica, sans-serif;
font-weight: 400;
@media screen and (max-width: $breakPoint) {
margin-right: 1.2rem;
margin-bottom: .2rem;
Expand Down
3 changes: 2 additions & 1 deletion components/styles/taglist.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
// color: #0c53c8;
font-size: 18px;
// letter-spacing: 0.08rem;
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "ヒラギノ角ゴ ProN W3", Arial, メイリオ, Meiryo, sans-serif;
font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "ヒラギノ角ゴ ProN W3", Arial, メイリオ, Meiryo, sans-serif;
font-weight: 500;
}
.tag::marker {
color: var(--color-text);
Expand Down
37 changes: 37 additions & 0 deletions components/styles/tagsInArticleList.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@import '../../styles/config';

.articleTags {
margin: 0 0 1rem 0;
// margin-top: 1rem;
// margin-bottom: 3rem;
}

.tag {
display: inline-block;
// background-color: #f1f1f1;
color: var(--color-link);
// padding: 0.3rem 0.8rem;
// margin: 0 0.7rem;
margin-right: 1.3rem;
margin-bottom: .3rem;
border-radius: 4px;
text-decoration: none;
font-weight: 300;
font-size: 17px;
font-family: 'Roboto', 'Segoe UI', 'Helvetica Neue', Arial, 'BIZ UDPGothic', 'Yu Gothic UI', 'Meiryo UI', Helvetica, sans-serif;
letter-spacing: .07rem;
line-height: 1rem;
@media screen and (max-width: $breakPoint) {
margin-right: .8rem;
margin-bottom: .2rem;
font-size: 15px;
}
}
.tag:last-child {
margin-right: 0;
}
.tag:hover {
// background-color: #f6f6f6;
// background-color: #e9e9e9;
// text-decoration: none;
}
1 change: 1 addition & 0 deletions gen/articleIds.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"13990": "202009120358_13990_develop-test-3.mdx",
"64403": "202008271034_64403_develop-test-1.mdx",
"75234": "202012290656_75234_markdown-style-test.mdx",
"80520": "202008301100_80520_develop-test-2.mdx"
}
13 changes: 13 additions & 0 deletions gen/articles.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,18 @@
"programming"
]
}
},
{
"slug": "75234",
"fileName": "202012290656_75234_markdown-style-test.mdx",
"fm": {
"title": "Mdxで書けるMarkdownのスタイル確認",
"date": "2020-12-29-06-56",
"tags": [
"mdx",
"markdown",
"blog"
]
}
}
]
21 changes: 21 additions & 0 deletions gen/tagMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,26 @@
"title": "本文無しのテスト記事だよ - 3",
"date": "2020-10-04-22-19"
}
],
"mdx": [
{
"slug": "75234",
"title": "Mdxで書けるMarkdownのスタイル確認",
"date": "2020-12-29-06-56"
}
],
"markdown": [
{
"slug": "75234",
"title": "Mdxで書けるMarkdownのスタイル確認",
"date": "2020-12-29-06-56"
}
],
"blog": [
{
"slug": "75234",
"title": "Mdxで書けるMarkdownのスタイル確認",
"date": "2020-12-29-06-56"
}
]
}
2 changes: 1 addition & 1 deletion lib/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { parse, format } from 'date-fns'
export function formatDate(date: string) {
const fmt = parse(date, 'yyyy-MM-dd-HH-mm', new Date())
// return format(fmt, 'yyyy/MM/dd HH:mm')
return format(fmt, 'yyyy-MM-dd')
return format(fmt, 'MMM d, yyyy')
}
12 changes: 9 additions & 3 deletions lib/getArticle.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import articles from '../gen/articles.json'

export function getSortedArticles(limit?: number) {
export function getSortedArticles(limit?: number, tag?: string) {

const items = articles.map(article => {
let items = articles.map(article => {
return {
slug: article.slug,
title: article.fm.title,
Expand All @@ -20,7 +20,13 @@ export function getSortedArticles(limit?: number) {
})

if (limit) {
return items.slice(0, limit)
items = items.slice(0, limit)
}

if (tag) {
items = items.filter(i => {
return i.tags.includes(tag)
})
}

return items
Expand Down
3 changes: 2 additions & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export default class MyDocument extends Document {
return (
<Html lang="ja">
<Head>
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@900&Montserrat:wght@700&display=swap" rel="stylesheet" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&Orbitron:wght@900&Montserrat:wght@700&display=swap" rel="stylesheet" />
</Head>
<body>
<Main />
Expand Down
2 changes: 1 addition & 1 deletion pages/tags/[tag].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
return {
props: {
tag: tag,
articles: getSortedArticles(),
articles: getSortedArticles(0, tag),
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// Default
:root {
--color-text: #333333;
--color-light-text: #4c4c4c;
// --color-light-text: #4c4c4c;
--color-light-text: #838383;
--color-bg: #fff;
--color-link: #0774b5;
--color-line: #ededed;
Expand Down

1 comment on commit 4f9a659

@vercel
Copy link

@vercel vercel bot commented on 4f9a659 Dec 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.