Skip to content

Commit a4ad9e3

Browse files
authored
Merge pull request #26 from 01-binary/responsive
Responsive
2 parents 270f611 + be54c6e commit a4ad9e3

File tree

10 files changed

+4189
-4818
lines changed

10 files changed

+4189
-4818
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- .storybook/preview-head.html -->
2+
<style>
3+
/* 스토리북 루트 요소에 적용될 스타일 */
4+
#storybook-root {
5+
width: 100% !important;
6+
max-width: 100% !important;
7+
box-sizing: border-box !important;
8+
padding: 0 !important;
9+
}
10+
11+
</style>

apps/storybook/.storybook/preview.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Preview } from '@storybook/react';
2-
// 중요: CSS 파일을 직접 가져옵니다
32
import 'notion-to-jsx/dist/index.css';
43

54
const preview: Preview = {

apps/storybook/src/stories/Renderer.stories.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,4 @@ export const DarkMode: Story = {
4242
title: notionProperties.Name,
4343
cover: notionProperties.coverUrl,
4444
},
45-
decorators: [
46-
(Story) => (
47-
<div
48-
style={{ background: '#1a1a1a', minHeight: '100vh', padding: '1em' }}
49-
>
50-
<Story />
51-
</div>
52-
),
53-
],
5445
};

packages/notion-to-jsx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"files": [
2121
"dist"
2222
],
23-
"sideEffects": false,
23+
"sideEffects": ["**/*.css", "**/*.css.ts"],
2424
"keywords": [
2525
"notion",
2626
"jsx",

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,11 @@ export const cover = style({
88
objectFit: 'cover',
99
objectPosition: 'center 50%',
1010
borderRadius: '1.5rem',
11+
margin: '0 auto',
12+
'@media': {
13+
'(max-width: 900px)': {
14+
borderRadius: '0.5rem',
15+
height: '25vh',
16+
},
17+
},
1118
});

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ export const previewContainer = style({
3636
justifyContent: 'center',
3737
maxHeight: '8rem',
3838
overflow: 'hidden',
39+
'@media': {
40+
'(max-width: 420px)': {
41+
display: 'none',
42+
},
43+
},
3944
});
4045

4146
export const previewImage = style({

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 & 6 deletions
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

@@ -68,11 +67,6 @@ export const styledImage = recipe({
6867
});
6968

7069
export const placeholder = style({
71-
// position: 'absolute',
72-
// top: 0,
73-
// left: 0,
74-
// right: 0,
75-
// bottom: 0,
7670
display: 'flex',
7771
alignItems: 'center',
7872
justifyContent: 'center',

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { style } from '@vanilla-extract/css';
22
import { vars } from '../../styles/theme.css';
33

44
export const container = style({
5-
maxWidth: '900px',
5+
maxWidth: '720px',
66
margin: '0 auto',
77
padding: vars.spacing.xl,
8+
'@media': {
9+
'(max-width: 720px)': {
10+
padding: vars.spacing.md,
11+
},
12+
},
813
});

0 commit comments

Comments
 (0)