Skip to content

Commit

Permalink
refactor: 모바일 모드에서 충전소 리스트 클릭 시, 리스트가 닫히는 기능 구현 (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielyoon7 authored Sep 20, 2023
1 parent 8885073 commit cd9827e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions frontend/src/components/ui/StationList/StationSummaryCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { css } from 'styled-components';

import { useStationSummary } from '@hooks/google-maps/useStationSummary';
import useMediaQueries from '@hooks/useMediaQueries';

import Button from '@common/Button';
import FlexBox from '@common/FlexBox';
Expand All @@ -20,8 +21,9 @@ interface Props {
}

const StationSummaryCard = ({ station, tag, $noPadding }: Props) => {
const { openLastPanel } = useNavigationBar();
const { openLastPanel, closeBasePanel } = useNavigationBar();
const { openStationSummary } = useStationSummary();
const screen = useMediaQueries();

const {
stationId,
Expand All @@ -42,7 +44,11 @@ const StationSummaryCard = ({ station, tag, $noPadding }: Props) => {
css={foundStationButton}
onClick={() => {
openStationSummary(stationId);
openLastPanel(<StationDetailsWindow stationId={stationId} />);
if (screen.get('isMobile')) {
closeBasePanel();
} else {
openLastPanel(<StationDetailsWindow stationId={stationId} />);
}
}}
>
<FlexBox alignItems="start" justifyContent="between" nowrap columnGap={2.8}>
Expand Down

0 comments on commit cd9827e

Please sign in to comment.