Skip to content

Commit 954ae98

Browse files
committed
feat: Image Component responsive add
1 parent b621df9 commit 954ae98

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/notion-to-jsx/src/components/Renderer/components/Image/Image.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export interface ImageProps {
2323
format?: ImageFormat;
2424
}
2525

26+
const MAX_WIDTH = 720;
27+
2628
const Image: React.FC<ImageProps> = ({
2729
src,
2830
alt,
@@ -48,7 +50,9 @@ const Image: React.FC<ImageProps> = ({
4850
format?.block_width
4951
? {
5052
width:
51-
format.block_width > 900 ? '100%' : `${format.block_width}px`,
53+
format.block_width > MAX_WIDTH
54+
? '100%'
55+
: `${format.block_width}px`,
5256
}
5357
: undefined
5458
}
@@ -58,7 +62,7 @@ const Image: React.FC<ImageProps> = ({
5862
className={placeholder}
5963
style={{
6064
width: format?.block_width
61-
? format.block_width > 900
65+
? format.block_width > MAX_WIDTH
6266
? '100%'
6367
: `${format.block_width}px`
6468
: '100%',
@@ -97,7 +101,7 @@ const Image: React.FC<ImageProps> = ({
97101
className={placeholder}
98102
style={{
99103
width: format?.block_width
100-
? format.block_width > 900
104+
? format.block_width > MAX_WIDTH
101105
? '100%'
102106
: `${format.block_width}px`
103107
: '100%',

packages/notion-to-jsx/src/components/Renderer/components/Image/styles.css.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export const imageContainer = style({
1515
alignItems: 'center',
1616
});
1717

18-
// CSS 변수 생성
1918
export const imageWidthVar = createVar();
2019
export const imageAspectRatioVar = createVar();
2120

0 commit comments

Comments
 (0)