Skip to content

Commit 661247e

Browse files
committed
move ContentHeader styles to CSS module
1 parent 7e91ca2 commit 661247e

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

src/components/viewers/ContentHeader.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { ReactNode } from 'react'
2-
import { formatFileSize } from '../../lib/utils.js'
2+
import { useConfig } from '../../hooks/useConfig.js'
3+
import { cn, formatFileSize } from '../../lib/utils.js'
4+
import styles from '../../styles/viewers/ContentHeader.module.css'
35

46
export interface ContentSize {
57
fileSize?: number
@@ -16,13 +18,14 @@ interface ContentHeaderProps {
1618
}
1719

1820
export default function ContentHeader({ content, headers, children }: ContentHeaderProps) {
19-
return <div className='viewer'>
20-
<div className='view-header'>
21+
const { customClass } = useConfig()
22+
return <div className={cn(styles.contentWrapper, customClass?.contentWrapper)}>
23+
<header>
2124
{content?.fileSize && <span title={content.fileSize.toLocaleString('en-US') + ' bytes'}>
2225
{formatFileSize(content.fileSize)}
2326
</span>}
2427
{headers}
25-
</div>
28+
</header>
2629
{children}
2730
</div>
2831
}

src/hooks/useConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { createContext, useContext } from 'react'
1010
export interface Config {
1111
customClass?: {
1212
brand?: string
13+
contentWrapper?: string
1314
highTable?: string
1415
imageView?: string
1516
markdownView?: string

src/styles/app.css

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -332,28 +332,6 @@ button.close-button:hover {
332332
background-image: url("../assets/folder.svg");
333333
}
334334

335-
/* viewer */
336-
.viewer {
337-
display: flex;
338-
flex: 1;
339-
flex-direction: column;
340-
white-space: pre-wrap;
341-
overflow-y: auto;
342-
}
343-
.view-header {
344-
align-items: center;
345-
background-color: #f2f2f2;
346-
color: #444;
347-
display: flex;
348-
gap: 16px;
349-
height: 24px;
350-
overflow: hidden;
351-
padding: 0 16px;
352-
/* all one line */
353-
text-overflow: ellipsis;
354-
white-space: nowrap;
355-
}
356-
357335
.slideContainer {
358336
display: flex;
359337
flex: 1;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.contentWrapper {
2+
display: flex;
3+
flex: 1;
4+
flex-direction: column;
5+
white-space: pre-wrap;
6+
overflow-y: auto;
7+
8+
& > header:first-child {
9+
align-items: center;
10+
background-color: #f2f2f2;
11+
color: #444;
12+
display: flex;
13+
gap: 16px;
14+
height: 24px;
15+
overflow: hidden;
16+
padding: 0 16px;
17+
/* all one line */
18+
text-overflow: ellipsis;
19+
white-space: nowrap;
20+
}
21+
}

0 commit comments

Comments
 (0)