Skip to content

Commit 49ef20e

Browse files
committed
#37 chore: 스타일 인라인 말고 스타일 인자로 전달
1 parent 131c5f9 commit 49ef20e

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/page/archiving/component/TimeBlock/TimeBlock.style.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1+
import { css } from '@emotion/react';
2+
13
import { theme } from '@/common/style/theme/theme';
24

3-
export const blockStyle = {
4-
display: 'flex',
5+
export const blockStyle = (width: number) =>
6+
css({
7+
display: 'flex',
58

6-
height: '5.6rem',
7-
padding: '0.5rem',
8-
justifyContent: 'center',
9-
alignItems: 'center',
9+
width: `${width}rem`,
10+
height: '5.6rem',
11+
padding: '0.5rem',
12+
justifyContent: 'center',
13+
alignItems: 'center',
1014

11-
borderRadius: '100px',
15+
borderRadius: '100px',
1216

13-
backgroundColor: theme.colors.blue_100,
14-
...theme.text.body03,
17+
backgroundColor: theme.colors.blue_100,
18+
...theme.text.body03,
1519

16-
overflow: 'hidden',
17-
textOverflow: 'ellipsis',
18-
whiteSpace: 'nowrap',
19-
};
20+
overflow: 'hidden',
21+
textOverflow: 'ellipsis',
22+
whiteSpace: 'nowrap',
23+
});
2024

2125
export const spanStyle = {
2226
padding: '2rem 0.8rem',

src/page/archiving/component/TimeBlock/TimeBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface TimeBlockProps {
1212
const TimeBlock = ({ children, width }: TimeBlockProps) => {
1313
return (
1414
<>
15-
<div css={[blockStyle, { width: `${width}rem` }]}>
15+
<div css={blockStyle(width)}>
1616
<Eclipse width={47} height={47} css={{ flexShrink: 0 }} />
1717
<span css={spanStyle}>{children}</span>
1818
</div>

0 commit comments

Comments
 (0)