Skip to content

Commit

Permalink
feat: getMediaQuery 유틸 함수 생성 및 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeJeongHooo committed Sep 11, 2024
1 parent e00536f commit 8ec47c4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
11 changes: 11 additions & 0 deletions packages/core/css-utils/src/getMediaQuery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { CSSObject } from '@emotion/react';

export const getMediaQuery = (mediaQuery: string, cssObject: CSSObject) => {
return {
[`@media (${mediaQuery})`]: cssObject,
};
};

export const mobileMediaQuery = (cssObject: CSSObject) => {
return getMediaQuery('max-width : 320px', cssObject);
};
1 change: 1 addition & 0 deletions packages/core/css-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { getBorder } from './getBorder';
export { getCssVar } from './getCssVar';
export { getPadding } from './getPadding';
export * from './getMediaQuery';
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import { mobileMediaQuery } from '@sambad/css-utils';
import { colors } from '@sambad/sds/theme';
import Image from 'next/image';

Expand Down Expand Up @@ -49,9 +50,7 @@ const NewMeetingClosingContainer = (props: NewMeetingClosingContainerProps) => {
aspectRatio: '11/5',
bottom: '184px',
transform: 'translate(-3%, 0)',
'@media (max-width: 320px)': {
display: 'none',
},
...mobileMediaQuery({ display: 'none' }),
}}
>
<Image src={Character} alt="meeting-character" priority fill />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { mobileMediaQuery } from '@sambad/css-utils';
import { Txt } from '@sambad/sds/components';
import { size, colors } from '@sambad/sds/theme';

Expand All @@ -8,9 +9,7 @@ export const InviteCodeHeader = () => {
marginTop: size['4xl'],
padding: `${size.xl} ${size['2xs']} ${size.xs}`,
textAlign: 'center',
'@media (max-width: 320px)': {
marginTop: 0,
},
...mobileMediaQuery({ marginTop: 0 }),
}}
>
<Txt as="h1" color={colors.black} typography="heading1">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { mobileMediaQuery } from '@sambad/css-utils';
import { Txt } from '@sambad/sds/components';
import { size, colors } from '@sambad/sds/theme';

Expand All @@ -16,9 +17,7 @@ export const ClosingHeader = ({ meetingName }: ClosingHeaderProps) => {
marginTop: size['4xl'],
padding: `${size.xl} ${size['2xs']} ${size.xs}`,
textAlign: 'center',
'@media (max-width: 320px)': {
marginTop: 0,
},
...mobileMediaQuery({ marginTop: 0 }),
}}
>
<Txt as="h1" color={colors.black} typography="heading1">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import { mobileMediaQuery } from '@sambad/css-utils';
import { Txt } from '@sambad/sds/components';
import { colors, size } from '@sambad/sds/theme';

Expand Down Expand Up @@ -29,14 +30,12 @@ export const OwnerStartContainer = () => {
<div
css={{
marginTop: size['4xl'],
'@media (max-width: 320px)': {
marginTop: 0,
},
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
padding: `${size.xl} ${size['2xs']} ${size.xs}`,
...mobileMediaQuery({ marginTop: 0 }),
}}
>
<CheckIcon />
Expand All @@ -59,9 +58,7 @@ export const OwnerStartContainer = () => {
css={{
position: 'relative',
width: '80%',
'@media (max-width: 320px)': {
width: '232px',
},
...mobileMediaQuery({ marginTop: 0 }),
}}
>
<OnwerCaracter css={{ position: 'absolute', height: '100%', width: '100%' }} />
Expand Down

0 comments on commit 8ec47c4

Please sign in to comment.