Skip to content

Commit 7e91ca2

Browse files
committed
move ImageView styles to CSS module
1 parent 126198a commit 7e91ca2

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/components/viewers/ImageView.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 { FileSource } from '../../lib/sources/types.js'
3-
import { contentTypes, parseFileSize } from '../../lib/utils.js'
4+
import { cn, contentTypes, parseFileSize } from '../../lib/utils.js'
5+
import styles from '../../styles/viewers/ImageView.module.css'
46
import { Spinner } from '../Layout.js'
57
import ContentHeader from './ContentHeader.js'
68

@@ -20,6 +22,7 @@ interface Content {
2022
export default function ImageView({ source, setError }: ViewerProps) {
2123
const [content, setContent] = useState<Content>()
2224
const [isLoading, setIsLoading] = useState(true)
25+
const { customClass } = useConfig()
2326

2427
const { fileName, resolveUrl, requestInit } = source
2528

@@ -54,7 +57,7 @@ export default function ImageView({ source, setError }: ViewerProps) {
5457
return <ContentHeader content={content}>
5558
{content?.dataUri && <img
5659
alt={source.sourceId}
57-
className='image'
60+
className={cn(styles.image, customClass?.imageView)}
5861
src={content.dataUri} />}
5962

6063
{isLoading && <div className='center'><Spinner /></div>}

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+
imageView?: string
1415
markdownView?: string
1516
sideBar?: string
1617
textView?: string

src/styles/app.css

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -353,22 +353,6 @@ button.close-button:hover {
353353
text-overflow: ellipsis;
354354
white-space: nowrap;
355355
}
356-
/* viewers */
357-
358-
/* images */
359-
.image {
360-
display: block;
361-
flex: 1;
362-
min-width: 0;
363-
object-fit: scale-down;
364-
background-image:
365-
linear-gradient(45deg, #ddd 25%, transparent 25%),
366-
linear-gradient(135deg, #ddd 25%, transparent 25%),
367-
linear-gradient(45deg, transparent 75%, #ddd 75%),
368-
linear-gradient(135deg, transparent 75%, #ddd 75%);
369-
background-size: 32px 32px;
370-
background-position:0 0, 16px 0, 16px -16px, 0px 16px;
371-
}
372356

373357
.slideContainer {
374358
display: flex;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.imageView {
2+
display: block;
3+
flex: 1;
4+
min-width: 0;
5+
object-fit: scale-down;
6+
background-image: linear-gradient(45deg, #ddd 25%, transparent 25%),
7+
linear-gradient(135deg, #ddd 25%, transparent 25%),
8+
linear-gradient(45deg, transparent 75%, #ddd 75%),
9+
linear-gradient(135deg, transparent 75%, #ddd 75%);
10+
background-size: 32px 32px;
11+
background-position: 0 0, 16px 0, 16px -16px, 0px 16px;
12+
}

0 commit comments

Comments
 (0)