Skip to content

Commit c3e1563

Browse files
author
wutali
committed
Finish styling post page
1 parent b0fb515 commit c3e1563

File tree

2 files changed

+47
-13
lines changed

2 files changed

+47
-13
lines changed

src/components/Copyright.tsx

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export default function Copyright() {
2+
return (
3+
<>
4+
<p>&copy; 2020</p>
5+
<style jsx>
6+
{`
7+
p {
8+
font-size: 0.75rem;
9+
text-align: center;
10+
}
11+
`}
12+
</style>
13+
</>
14+
);
15+
}

src/layouts/index.tsx

+32-13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import Date from "../components/Date";
44
import Layout from "../components/Layout";
55
import TagButton from "../components/TagButton";
66
import { getTag } from "../lib/tags";
7+
import { SocialList } from "../components/SocialList";
8+
import Copyright from "../components/Copyright";
79

810
type Props = {
911
title: string;
@@ -14,26 +16,39 @@ export default function Index({ title, date, tags }: Props) {
1416
return ({ children: content }) => {
1517
return (
1618
<Layout>
17-
<div className={"post"}>
18-
<h1>{title}</h1>
19-
<Date dateString={date} />
20-
<div className={styles.content}>{content}</div>
21-
<ul className={"tag-list"}>
22-
{tags &&
23-
tags.map((it, i) => (
24-
<li key={i}>
25-
<TagButton tag={getTag(it)} />
26-
</li>
27-
))}
28-
</ul>
19+
<div className={"container"}>
20+
<article>
21+
<h1>{title}</h1>
22+
<Date dateString={date} />
23+
<div className={styles.content}>{content}</div>
24+
<ul className={"tag-list"}>
25+
{tags &&
26+
tags.map((it, i) => (
27+
<li key={i}>
28+
<TagButton tag={getTag(it)} />
29+
</li>
30+
))}
31+
</ul>
32+
</article>
33+
<footer>
34+
<div className={"social-list"}>
35+
<SocialList />
36+
</div>
37+
<Copyright />
38+
</footer>
2939
</div>
3040
<style jsx>
3141
{`
32-
.post {
42+
.container {
43+
display: flex;
44+
flex-direction: column;
3345
max-width: 36rem;
3446
width: 100%;
3547
margin: 0 auto;
3648
}
49+
article {
50+
flex: 1;
51+
}
3752
h1 {
3853
margin: 0 0 0.5rem;
3954
font-size: 2.25rem;
@@ -48,6 +63,10 @@ export default function Index({ title, date, tags }: Props) {
4863
display: inline-block;
4964
margin-left: 0.5rem;
5065
}
66+
.social-list {
67+
margin-top: 3rem;
68+
text-align: center;
69+
}
5170
`}
5271
</style>
5372
<style global jsx>

0 commit comments

Comments
 (0)