Skip to content

Commit

Permalink
fix : 거리 반올림
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondanythings committed Mar 30, 2023
1 parent 7d4e799 commit 06d5ef1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/components/Search/DestinationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ const DestinationCard: FC<any> = ({ node, maxLength, idx, fetchMore }) => {
<LocationWrapper>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<h4 className='title-medium text-bold'>{node.name}</h4>
<span className='title-small main-text'>
나와의 거리 {getDistance(node.distance)}km
</span>
<span className='title-small main-text'>나와의 거리 {getDistance(node.distance)}</span>
<Address className='body-small2 text-subdark'>
{node.address
.split(' ')
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Coord } from 'types/kakaoMap'

export const getIsMobile = () => /Android|iPhone/i.test(navigator.userAgent)

export const getDistance = (distance: number) => distance / 1000
export const getDistance = (distance: number) => `약 ${Math.round(distance / 1000) / 10}km`

export const linkToKaKaoMap = (coord: Coord) => {
const isMobile = getIsMobile()
Expand Down

0 comments on commit 06d5ef1

Please sign in to comment.