Skip to content

Commit

Permalink
Feat: media.tsx 파일 추가 #13
Browse files Browse the repository at this point in the history
media.tsx 파일에 반응형 크기 설정 파일 생성
  • Loading branch information
devhaeun committed Jan 26, 2025
1 parent 5f0505f commit f6353bf
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/styles/media.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { css, type CSSObject, type Interpolation } from 'styled-components';

export type Breakpoints = 'small' | 'medium' | 'large' | 'notLarge';

export const breakpoints: Record<Breakpoints, string> = {
small: '@media (max-width: 375px)',
medium: '@media (max-width: 744px)',
large: '@media (min-width: 745px)',
notLarge: '@media not all and (min-width: 745px)',
};

const media = Object.entries(breakpoints).reduce((acc, [key, value]) => {
return {
...acc,
[key]: (
first: CSSObject | TemplateStringsArray,
...interpolations: Interpolation<Object>[]
) => css`
${value} {
${css(first, ...interpolations)}
}
`,
};
}, {}) as Record<Breakpoints, any>;

export default media;

0 comments on commit f6353bf

Please sign in to comment.