Skip to content

Commit 54e6123

Browse files
author
wutali
committed
Add styles for content
1 parent ddce5e6 commit 54e6123

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

public/admin/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ collections:
7474

7575
- name: "posts"
7676
label: "Posts"
77-
folder: "pages/posts"
77+
folder: "src/pages/posts"
7878
extension: "mdx"
7979
format: "frontmatter"
8080
create: true

public/admin/index.html

+6
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,11 @@
99
<body>
1010
<!-- Include the script that builds the page and powers Netlify CMS -->
1111
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
12+
<script>
13+
CMS.registerPreviewStyle(
14+
"https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400&display=swap"
15+
);
16+
CMS.registerPreviewStyle("/styles/content.module.css");
17+
</script>
1218
</body>
1319
</html>

public/styles/content.module.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.content p {
2+
line-height: 1.5rem;
3+
}

src/styles/global.css renamed to public/styles/global.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body {
99
height: 100%;
1010
flex: 1;
1111
font-weight: 200;
12-
letter-spacing: 0.05em;
12+
letter-spacing: 0.05rem;
1313
}
1414

1515
#__next {

src/layouts/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import React from "react";
22
import Layout from "../components/Layout";
33
import Date from "../components/Date";
4+
import styles from "../../public/styles/content.module.css";
45

56
type Props = {
67
title: string;
78
date: string;
89
};
9-
export default function ({ title, date }: Props) {
10+
export default function Index({ title, date }: Props) {
1011
return ({ children: content }) => {
1112
return (
1213
<Layout>
1314
<div className={"post"}>
1415
<h1>{title}</h1>
1516
<Date dateString={date} />
16-
{content}
17+
<div className={styles.content}>{content}</div>
1718
</div>
1819
<style jsx>
1920
{`

src/pages/_app.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import "normalize.css";
2-
import "../styles/global.css";
32
import { AppProps } from "next/app";
3+
// NOTE: Do not move the styles dir to the src.
4+
// They are used by the Netlify CMS preview feature.
5+
import "../../public/styles/global.css";
46

57
export default function App({ Component, pageProps }: AppProps) {
68
return <Component {...pageProps} />;

0 commit comments

Comments
 (0)