diff --git a/frontend/src/assets/svg/error-image.svg b/frontend/src/assets/svg/error-image.svg index 01772e2df..899f21291 100644 --- a/frontend/src/assets/svg/error-image.svg +++ b/frontend/src/assets/svg/error-image.svg @@ -1,4 +1,4 @@ - + diff --git a/frontend/src/components/common/Error/Error.tsx b/frontend/src/components/common/Error/Error.tsx index f50edd9d0..6e9ca00a2 100644 --- a/frontend/src/components/common/Error/Error.tsx +++ b/frontend/src/components/common/Error/Error.tsx @@ -1,6 +1,8 @@ import ErrorImage from '@assets/svg/error-image.svg'; import { HTTP_ERROR_MESSAGE } from '@constants/api'; +import { mediaQueryMobileState } from '@store/mediaQuery'; import { Box, Button, Flex, Heading, Text } from 'hang-log-design-system'; +import { useRecoilValue } from 'recoil'; import { hasKeyInObject } from '@utils/typeGuard'; @@ -18,13 +20,14 @@ export interface ErrorProps { const Error = ({ statusCode = 404, resetError }: ErrorProps) => { const isHTTPError = hasKeyInObject(HTTP_ERROR_MESSAGE, statusCode); + const isMobile = useRecoilValue(mediaQueryMobileState); if (!isHTTPError) return null; return ( - + {HTTP_ERROR_MESSAGE[statusCode].HEADING} diff --git a/frontend/src/components/expense/ExpenseInformation/ExpenseInformation.style.ts b/frontend/src/components/expense/ExpenseInformation/ExpenseInformation.style.ts index 498c0b1c2..9bdc9c573 100644 --- a/frontend/src/components/expense/ExpenseInformation/ExpenseInformation.style.ts +++ b/frontend/src/components/expense/ExpenseInformation/ExpenseInformation.style.ts @@ -4,8 +4,12 @@ import { Theme } from 'hang-log-design-system'; export const sectionStyling = css({ position: 'relative', width: '100%', - padding: `${Theme.spacer.spacing4} 0`, marginBottom: Theme.spacer.spacing5, + padding: `${Theme.spacer.spacing4} 0`, + + '@media screen and (max-width: 600px)': { + marginBottom: Theme.spacer.spacing3, + }, }); export const titleStyling = css({ @@ -15,4 +19,23 @@ export const titleStyling = css({ export const badgeWrapperStyling = css({ width: '60%', + minHeight: '24px', + marginBottom: Theme.spacer.spacing2, + + overflowX: 'scroll', + whiteSpace: 'nowrap', + '-ms-overflow-style': 'none', + scrollbarWidth: 'none', + + '& > span': { + marginRight: Theme.spacer.spacing1, + }, + + '::-webkit-scrollbar': { + display: 'none', + }, + + '@media screen and (max-width: 600px)': { + width: 'calc(100vw - 220px)', + }, }); diff --git a/frontend/src/components/expense/ExpenseInformation/ExpenseInformation.tsx b/frontend/src/components/expense/ExpenseInformation/ExpenseInformation.tsx index 09ee45026..35bb361dc 100644 --- a/frontend/src/components/expense/ExpenseInformation/ExpenseInformation.tsx +++ b/frontend/src/components/expense/ExpenseInformation/ExpenseInformation.tsx @@ -1,5 +1,7 @@ +import { mediaQueryMobileState } from '@store/mediaQuery'; import type { ExpenseData } from '@type/expense'; -import { Badge, Flex, Heading, Text, Theme } from 'hang-log-design-system'; +import { Badge, Box, Heading, Text } from 'hang-log-design-system'; +import { useRecoilValue } from 'recoil'; import { formatDate } from '@utils/formatter'; @@ -15,14 +17,16 @@ interface ExpenseInformationProps } const ExpenseInformation = ({ ...information }: ExpenseInformationProps) => { + const isMobile = useRecoilValue(mediaQueryMobileState); + return (
- + {information.cities.map(({ id, name }) => ( {name} ))} - - +
+ {information.title} diff --git a/frontend/src/components/expense/ExpenseListSection/ExpenseListSection.style.ts b/frontend/src/components/expense/ExpenseListSection/ExpenseListSection.style.ts index 352ccd611..fc6bbc377 100644 --- a/frontend/src/components/expense/ExpenseListSection/ExpenseListSection.style.ts +++ b/frontend/src/components/expense/ExpenseListSection/ExpenseListSection.style.ts @@ -9,6 +9,13 @@ export const containerStyling = css({ width: '50vw', marginTop: '140px', padding: '0 50px', + + '@media screen and (max-width: 600px)': { + marginTop: Theme.spacer.spacing0, + + width: '100vw', + padding: `0 ${Theme.spacer.spacing4}`, + }, }); export const toggleGroupStyling = css({ diff --git a/frontend/src/components/expense/ExpenseListSection/ExpenseListSection.tsx b/frontend/src/components/expense/ExpenseListSection/ExpenseListSection.tsx index 4dffbf2e0..4ef4e3ea8 100644 --- a/frontend/src/components/expense/ExpenseListSection/ExpenseListSection.tsx +++ b/frontend/src/components/expense/ExpenseListSection/ExpenseListSection.tsx @@ -1,5 +1,7 @@ import { EXPENSE_LIST_FILTERS } from '@constants/expense'; -import { Toggle, ToggleGroup, useSelect } from 'hang-log-design-system'; +import { mediaQueryMobileState } from '@store/mediaQuery'; +import { Flex, Heading, Toggle, ToggleGroup, useSelect } from 'hang-log-design-system'; +import { useRecoilValue } from 'recoil'; import ExpenseCategories from '@components/expense/ExpenseCategories/ExpenseCategories'; import ExpenseDates from '@components/expense/ExpenseDates/ExpenseDates'; @@ -13,28 +15,33 @@ interface ExpenseListProps { } const ExpenseListSection = ({ tripId }: ExpenseListProps) => { + const isMobile = useRecoilValue(mediaQueryMobileState); + const { selected: selectedFilter, handleSelectClick: handleFilterSelectClick } = useSelect( EXPENSE_LIST_FILTERS.DAY_LOG ); return (
- - - - + + {isMobile && 경비 상세 정보} + + + + + {selectedFilter === EXPENSE_LIST_FILTERS.DAY_LOG ? ( ) : ( diff --git a/frontend/src/components/expense/ExpenseListSection/ExpenseListSectionSkeleton.tsx b/frontend/src/components/expense/ExpenseListSection/ExpenseListSectionSkeleton.tsx index f9d492dc3..b0dc073eb 100644 --- a/frontend/src/components/expense/ExpenseListSection/ExpenseListSectionSkeleton.tsx +++ b/frontend/src/components/expense/ExpenseListSection/ExpenseListSectionSkeleton.tsx @@ -1,4 +1,6 @@ +import { mediaQueryMobileState } from '@store/mediaQuery'; import { Flex, Skeleton, Theme } from 'hang-log-design-system'; +import { useRecoilValue } from 'recoil'; import ExpenseListSkeleton from '@components/expense/ExpenseList/ExpenseListSkeleton'; import { @@ -7,9 +9,14 @@ import { } from '@components/expense/ExpenseListSection/ExpenseListSection.style'; const ExpenseListSectionSkeleton = () => { + const isMobile = useRecoilValue(mediaQueryMobileState); + return (
- + + {isMobile && } + + { + const isMobile = useRecoilValue(mediaQueryMobileState); + const { expenseData } = useExpense(tripId); const chartData = expenseData.categories.reduce((acc, curr) => { @@ -45,7 +49,7 @@ const TotalExpenseSection = ({ tripId }: TotalExpenseSectionProps) => { endDate={expenseData.endDate} cities={expenseData.cities} /> - + 총 경비 :{' '}
{CURRENCY_ICON[DEFAULT_CURRENCY]} diff --git a/frontend/src/pages/ExpensePage/ExpensePage.style.ts b/frontend/src/pages/ExpensePage/ExpensePage.style.ts index e45df5675..8ba1f603c 100644 --- a/frontend/src/pages/ExpensePage/ExpensePage.style.ts +++ b/frontend/src/pages/ExpensePage/ExpensePage.style.ts @@ -5,4 +5,14 @@ export const containerStyling = css({ minHeight: `calc(100vh - 81px - ${Theme.spacer.spacing6})`, marginBottom: Theme.spacer.spacing6, + + '@media screen and (max-width: 600px)': { + flexDirection: 'column', + gap: Theme.spacer.spacing5, + }, +}); + +export const dividerStyling = css({ + width: `calc(100vw - ${Theme.spacer.spacing6})`, + margin: `0 ${Theme.spacer.spacing4}`, }); diff --git a/frontend/src/pages/ExpensePage/ExpensePage.tsx b/frontend/src/pages/ExpensePage/ExpensePage.tsx index 166208881..4d876916f 100644 --- a/frontend/src/pages/ExpensePage/ExpensePage.tsx +++ b/frontend/src/pages/ExpensePage/ExpensePage.tsx @@ -1,9 +1,11 @@ -import { Flex } from 'hang-log-design-system'; +import { mediaQueryMobileState } from '@store/mediaQuery'; +import { Divider, Flex } from 'hang-log-design-system'; import { useParams } from 'react-router-dom'; +import { useRecoilValue } from 'recoil'; import { useExpenseQuery } from '@hooks/api/useExpenseQuery'; -import { containerStyling } from '@pages/ExpensePage/ExpensePage.style'; +import { containerStyling, dividerStyling } from '@pages/ExpensePage/ExpensePage.style'; import ExpenseListSection from '@components/expense/ExpenseListSection/ExpenseListSection'; import TotalExpenseSection from '@components/expense/TotalExpenseSection/TotalExpenseSection'; @@ -13,11 +15,14 @@ const ExpensePage = () => { if (!tripId) throw new Error('존재하지 않는 tripId 입니다.'); + const isMobile = useRecoilValue(mediaQueryMobileState); + const { expenseData } = useExpenseQuery(Number(tripId)); return ( + {isMobile && } ); diff --git a/frontend/src/pages/ExpensePage/ExpensePageSkeleton.tsx b/frontend/src/pages/ExpensePage/ExpensePageSkeleton.tsx index 02ad43fe5..06f8ec426 100644 --- a/frontend/src/pages/ExpensePage/ExpensePageSkeleton.tsx +++ b/frontend/src/pages/ExpensePage/ExpensePageSkeleton.tsx @@ -1,14 +1,19 @@ -import { Flex } from 'hang-log-design-system'; +import { mediaQueryMobileState } from '@store/mediaQuery'; +import { Divider, Flex } from 'hang-log-design-system'; +import { useRecoilValue } from 'recoil'; -import { containerStyling } from '@pages/ExpensePage/ExpensePage.style'; +import { containerStyling, dividerStyling } from '@pages/ExpensePage/ExpensePage.style'; import ExpenseListSectionSkeleton from '@components/expense/ExpenseListSection/ExpenseListSectionSkeleton'; import TotalExpenseSectionSkeleton from '@components/expense/TotalExpenseSection/TotalExpenseSectionSkeleton'; const ExpensePageSkeleton = () => { + const isMobile = useRecoilValue(mediaQueryMobileState); + return ( + {isMobile && } ); diff --git a/frontend/src/pages/NotFoundPage/NotFoundPage.tsx b/frontend/src/pages/NotFoundPage/NotFoundPage.tsx index ffe621971..1d4c7703f 100644 --- a/frontend/src/pages/NotFoundPage/NotFoundPage.tsx +++ b/frontend/src/pages/NotFoundPage/NotFoundPage.tsx @@ -1,11 +1,15 @@ import { PATH } from '@constants/path'; import { useNavigate } from 'react-router-dom'; +import { useMediaQuery } from '@hooks/common/useMediaQuery'; + import Error from '@components/common/Error/Error'; const NotFoundPage = () => { const navigate = useNavigate(); + useMediaQuery(); + return navigate(PATH.ROOT)} />; };