Skip to content

Commit 3fe4514

Browse files
committed
move MarkdownView styles to CSS module
1 parent ba03e51 commit 3fe4514

File tree

4 files changed

+38
-34
lines changed

4 files changed

+38
-34
lines changed

src/components/viewers/MarkdownView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { useEffect, useState } from 'react'
2+
import { useConfig } from '../../hooks/useConfig.js'
23
import type { FileSource } from '../../lib/sources/types.js'
3-
import { parseFileSize } from '../../lib/utils.js'
4+
import { cn, parseFileSize } from '../../lib/utils.js'
5+
import styles from '../../styles/MarkdownView.module.css'
46
import { Spinner } from '../Layout.js'
57
import Markdown from '../Markdown.js'
68
import ContentHeader, { TextContent } from './ContentHeader.js'
@@ -16,6 +18,7 @@ interface ViewerProps {
1618
export default function MarkdownView({ source, setError }: ViewerProps) {
1719
const [content, setContent] = useState<TextContent>()
1820
const [isLoading, setIsLoading] = useState(true)
21+
const { customClass } = useConfig()
1922

2023
const { resolveUrl, requestInit } = source
2124

@@ -45,7 +48,7 @@ export default function MarkdownView({ source, setError }: ViewerProps) {
4548
}, [resolveUrl, requestInit, setError])
4649

4750
return <ContentHeader content={content}>
48-
<Markdown className='markdown' text={content?.text ?? ''} />
51+
<Markdown className={cn(styles.markdownView, customClass?.markdownView)} text={content?.text ?? ''} />
4952

5053
{ isLoading && <div className='center'><Spinner /></div> }
5154
</ContentHeader>

src/hooks/useConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface Config {
1111
customClass?: {
1212
brand?: string
1313
highTable?: string
14+
markdownView?: string
1415
sideBar?: string
1516
textView?: string
1617
welcome?: string

src/styles/app.css

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -369,38 +369,6 @@ button.close-button:hover {
369369
background-size: 32px 32px;
370370
background-position:0 0, 16px 0, 16px -16px, 0px 16px;
371371
}
372-
/* markdown */
373-
.markdown {
374-
background-color: #222226;
375-
color: #ddd;
376-
flex: 1;
377-
padding: 8px 20px;
378-
white-space: pre-wrap;
379-
overflow-y: auto;
380-
}
381-
.markdown a {
382-
color: #cdf;
383-
}
384-
.markdown p {
385-
margin-block: 1em;
386-
}
387-
.markdown pre {
388-
background-color: #34343a;
389-
border-left: #446 solid 5px;
390-
margin: 0;
391-
padding: 12px 14px;
392-
white-space: pre-wrap;
393-
}
394-
.markdown h1 {
395-
font-size: 32px;
396-
font-weight: 500;
397-
margin-bottom: 8px;
398-
}
399-
.markdown h2 {
400-
font-weight: 500;
401-
margin-bottom: 8px;
402-
margin-top: 16px;
403-
}
404372

405373
.slideContainer {
406374
display: flex;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* markdownView */
2+
.markdownView {
3+
background-color: #222226;
4+
color: #ddd;
5+
flex: 1;
6+
padding: 8px 20px;
7+
white-space: pre-wrap;
8+
overflow-y: auto;
9+
}
10+
.markdownView a {
11+
color: #cdf;
12+
}
13+
.markdownView p {
14+
margin-block: 1em;
15+
}
16+
.markdownView pre {
17+
background-color: #34343a;
18+
border-left: #446 solid 5px;
19+
margin: 0;
20+
padding: 12px 14px;
21+
white-space: pre-wrap;
22+
}
23+
.markdownView h1 {
24+
font-size: 32px;
25+
font-weight: 500;
26+
margin-bottom: 8px;
27+
}
28+
.markdownView h2 {
29+
font-weight: 500;
30+
margin-bottom: 8px;
31+
margin-top: 16px;
32+
}

0 commit comments

Comments
 (0)