Skip to content

Commit d29c129

Browse files
committed
Styling fixes and alignments
1 parent 5a4a93c commit d29c129

File tree

3 files changed

+35
-24
lines changed

3 files changed

+35
-24
lines changed

example/pages/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const {
77

88
const Home = () => (
99
<div
10+
className="notion"
1011
style={{
1112
maxWidth: 708,
1213
margin: "0 auto",

src/components/code.tsx

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,19 @@ const Code: React.FC<{ code: string; language: string }> = ({
77
language = "javascript"
88
}) => {
99
return (
10-
<>
11-
<pre>
12-
<code
13-
className="rounded"
14-
style={{
15-
padding: "30px 16px 30px 20px",
16-
tabSize: 2,
17-
fontSize: "85%",
18-
display: "block",
19-
background: "rgb(247, 246, 243)",
20-
fontFamily:
21-
'SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace'
22-
}}
23-
dangerouslySetInnerHTML={{
24-
__html: Prism.highlight(
25-
code,
26-
Prism.languages[language.toLowerCase()] ||
27-
Prism.languages.javascript,
28-
language
29-
)
30-
}}
31-
/>
32-
</pre>
33-
</>
10+
<pre>
11+
<code
12+
className="notion-code"
13+
dangerouslySetInnerHTML={{
14+
__html: Prism.highlight(
15+
code,
16+
Prism.languages[language.toLowerCase()] ||
17+
Prism.languages.javascript,
18+
language
19+
)
20+
}}
21+
/>
22+
</pre>
3423
);
3524
};
3625

src/styles.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
caret-color: rgb(55, 53, 47);
66
}
77

8+
.notion > * {
9+
padding: 3px 0px;
10+
}
11+
12+
* {
13+
margin-block-start: 0px;
14+
margin-block-end: 0px;
15+
}
16+
817
.notion-red {
918
color: rgb(224, 62, 62);
1019
}
@@ -185,6 +194,8 @@ li {
185194
display: flex;
186195
justify-content: center;
187196
flex-direction: column;
197+
margin-top: 2px;
198+
margin-bottom: 0.5em;
188199
}
189200
.notion-text {
190201
white-space: pre-wrap;
@@ -224,3 +235,13 @@ li {
224235
.notion-callout-text {
225236
margin-left: 8px;
226237
}
238+
.notion-code {
239+
padding: 30px 16px 30px 20px;
240+
margin: 4px 0;
241+
tab-size: 2;
242+
font-size: 85%;
243+
display: block;
244+
background: rgb(247, 246, 243);
245+
font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier,
246+
monospace;
247+
}

0 commit comments

Comments
 (0)