Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 길찾기 기능을 구현한다 #881

Merged
merged 4 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions frontend/src/components/ui/StationInfoWindow/PathFinding.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { BiSolidCar } from 'react-icons/bi';

import FlexBox from '@common/FlexBox';
import type { FlexBoxProps } from '@common/FlexBox/FlexBox';
import Text from '@common/Text';

import type { Station } from '@type';

interface PathFindingProps
extends Pick<Station, 'address' | 'latitude' | 'longitude'>,
FlexBoxProps {}

const PathFinding = ({ address, latitude, longitude, ...props }: PathFindingProps) => {
const KAKAO_MAP_LINK = `https://map.kakao.com/link/to/${address},${latitude},${longitude}`;

return (
<FlexBox
tag="a"
alignItems="center"
rel="noreferrer"
href={KAKAO_MAP_LINK}
target="_blank"
{...props}
>
<Text variant="label" weight='regular'>길찾기</Text>
<BiSolidCar />
</FlexBox>
);
};

export default PathFinding;
34 changes: 24 additions & 10 deletions frontend/src/components/ui/StationInfoWindow/StationInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import Text from '@common/Text';

import type { StationDetails } from '@type';

import PathFinding from './PathFinding';

export interface StationInfoProps {
stationDetails: StationDetails;
handleOpenStationDetail: () => void;
Expand All @@ -24,8 +26,17 @@ const StationInfo = ({
handleOpenStationDetail,
handleCloseStationWindow,
}: StationInfoProps) => {
const { address, chargers, companyName, isParkingFree, isPrivate, stationId, stationName } =
stationDetails;
const {
address,
chargers,
companyName,
isParkingFree,
isPrivate,
stationId,
stationName,
longitude,
latitude,
} = stationDetails;

const {
isAvailable,
Expand Down Expand Up @@ -91,14 +102,17 @@ const StationInfo = ({
</Text>
</FlexBox>

<Button onClick={handleOpenStationDetail} mt={3} hover>
<FlexBox alignItems="center">
<Text variant="label" mb={0.75}>
상세 정보 보기
</Text>
<HiChevronRight />
</FlexBox>
</Button>
<FlexBox mt={3} justifyContent="between">
<Button onClick={handleOpenStationDetail} hover>
<FlexBox alignItems="center">
<Text variant="label" mb={0.75}>
상세 정보 보기
</Text>
<HiChevronRight />
</FlexBox>
</Button>
<PathFinding address={address} latitude={latitude} longitude={longitude} />
</FlexBox>
</Box>
);
};
Expand Down
66 changes: 0 additions & 66 deletions frontend/src/components/ui/StationInfoWindow/SummaryButtons.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useState } from 'react';
import { useSearchStations } from '@hooks/tanstack-query/useSearchStations';
import { useDebounce } from '@hooks/useDebounce';

import Box from '@common/Box';
import FlexBox from '@common/FlexBox';
import Loader from '@common/Loader';

Expand Down
Loading