-
Notifications
You must be signed in to change notification settings - Fork 3
[Feature] 지도 핀마커 오버레이 UI 컴포넌트 구현 #38
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
329cad3
feat: 핀마커 아이콘 컴포넌트
mindaaaa fbb6a89
docs: README 포매팅 및 팀 블로그 링크 추가
mindaaaa fd27e81
fix(web): ESLint 에러 수정
mindaaaa 348ee56
feat: 핀마커 타입 정의 추가
mindaaaa b2ef034
chore: 핀마커 아이콘 파일 내용 수정
mindaaaa 7e7e5a3
feat: PinMarker 컴포넌트 초기 구현
mindaaaa 986ef81
docs: PinMarker 컴포넌트 Storybook 스토리 추가
mindaaaa 8764b3c
style: 불필요한 shadow css 속성 제거
mindaaaa 0135f5d
style: 핀마커 애니메이션 강도 조정
mindaaaa 17b56ef
style: 파란 핀 선택 시 + 표시 pulse 애니메이션 추가
mindaaaa 32a979b
refactor: PinMarker 스토리 간소화
mindaaaa 66b8f40
refactor: PinMarker 조건문을 변수로 추출하여 가독성 개선
mindaaaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
apps/web/src/shared/icons/PinMarkerCompletedIcon.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react-vite'; | ||
| import PinMarkerCompletedIcon from './PinMarkerCompletedIcon'; | ||
|
|
||
| const meta = { | ||
| title: 'Shared/Icons/PinMarkerCompletedIcon', | ||
| component: PinMarkerCompletedIcon, | ||
| parameters: { | ||
| layout: 'centered', | ||
| }, | ||
| tags: ['autodocs'], | ||
| argTypes: { | ||
| className: { | ||
| control: 'text', | ||
| description: 'Tailwind CSS classes for styling (size, color, etc.)', | ||
| }, | ||
| }, | ||
| } satisfies Meta<typeof PinMarkerCompletedIcon>; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = { | ||
| args: {}, | ||
| }; | ||
|
|
||
| export const DifferentSizes: Story = { | ||
| render: () => ( | ||
| <div className="flex gap-4 items-end"> | ||
| <PinMarkerCompletedIcon className="w-14 h-20" /> | ||
| <PinMarkerCompletedIcon className="w-28 h-40" /> | ||
| <PinMarkerCompletedIcon className="w-42 h-60" /> | ||
| </div> | ||
| ), | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import type { IconProps } from '../types'; | ||
|
|
||
| export default function PinMarkerCompletedIcon({ | ||
| className, | ||
| ...props | ||
| }: IconProps) { | ||
| return ( | ||
| <svg | ||
| {...props} | ||
| className={className} | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="56" | ||
| height="79" | ||
| viewBox="0 0 56 79" | ||
| fill="none" | ||
| aria-hidden="true" | ||
| > | ||
| <path | ||
| opacity="0.2" | ||
| d="M28 75.5985C32.6391 75.5985 36.3998 74.3449 36.3998 72.7985C36.3998 71.2521 32.6391 69.9986 28 69.9986C23.3609 69.9986 19.6002 71.2521 19.6002 72.7985C19.6002 74.3449 23.3609 75.5985 28 75.5985Z" | ||
| fill="black" | ||
| /> | ||
| <path | ||
| d="M28 44.7991V69.9986" | ||
| stroke="#8B5CF6" | ||
| strokeWidth="3.49993" | ||
| strokeLinecap="round" | ||
| /> | ||
| <path | ||
| d="M28 5.59988C39.1998 5.59988 44.7997 13.9997 44.7997 25.1995C44.7997 36.3993 28 44.7991 28 44.7991C28 44.7991 11.2003 36.3993 11.2003 25.1995C11.2003 13.9997 16.8002 5.59988 28 5.59988Z" | ||
| fill="#A78BFA" | ||
| stroke="#7C3AED" | ||
| strokeWidth="2.79994" | ||
| /> | ||
| <path | ||
| opacity="0.9" | ||
| d="M28 30.7994C32.6391 30.7994 36.3998 27.0386 36.3998 22.3995C36.3998 17.7604 32.6391 13.9997 28 13.9997C23.3609 13.9997 19.6002 17.7604 19.6002 22.3995C19.6002 27.0386 23.3609 30.7994 28 30.7994Z" | ||
| fill="white" | ||
| /> | ||
| <path | ||
| d="M25.2001 25.1995V16.7997L32.1999 19.5996L25.2001 22.3995V25.1995Z" | ||
| fill="#7C3AED" | ||
| /> | ||
| <path | ||
| d="M25.2001 16.7997V27.9994" | ||
| stroke="#7C3AED" | ||
| strokeWidth="2.09996" | ||
| strokeLinecap="round" | ||
| /> | ||
| <path | ||
| opacity="0.3" | ||
| d="M22.4001 18.1996C25.4928 18.1996 28 16.3193 28 13.9997C28 11.6802 25.4928 9.7998 22.4001 9.7998C19.3074 9.7998 16.8002 11.6802 16.8002 13.9997C16.8002 16.3193 19.3074 18.1996 22.4001 18.1996Z" | ||
| fill="white" | ||
| /> | ||
| </svg> | ||
| ); | ||
| } | ||
34 changes: 34 additions & 0 deletions
34
apps/web/src/shared/icons/PinMarkerPendingIcon.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react-vite'; | ||
| import PinMarkerPendingIcon from './PinMarkerPendingIcon'; | ||
|
|
||
| const meta = { | ||
| title: 'Shared/Icons/PinMarkerPendingIcon', | ||
| component: PinMarkerPendingIcon, | ||
| parameters: { | ||
| layout: 'centered', | ||
| }, | ||
| tags: ['autodocs'], | ||
| argTypes: { | ||
| className: { | ||
| control: 'text', | ||
| description: 'Tailwind CSS classes for styling (size, color, etc.)', | ||
| }, | ||
| }, | ||
| } satisfies Meta<typeof PinMarkerPendingIcon>; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = { | ||
| args: {}, | ||
| }; | ||
|
|
||
| export const DifferentSizes: Story = { | ||
| render: () => ( | ||
| <div className="flex gap-4 items-end"> | ||
| <PinMarkerPendingIcon className="w-14 h-20" /> | ||
| <PinMarkerPendingIcon className="w-28 h-40" /> | ||
| <PinMarkerPendingIcon className="w-42 h-60" /> | ||
| </div> | ||
| ), | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import type { IconProps } from '../types'; | ||
|
|
||
| export default function PinMarkerPendingIcon({ | ||
| className, | ||
| ...props | ||
| }: IconProps) { | ||
| return ( | ||
| <svg | ||
| {...props} | ||
| className={className} | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="56" | ||
| height="79" | ||
| viewBox="0 0 56 79" | ||
| fill="none" | ||
| aria-hidden="true" | ||
| > | ||
| <path | ||
| opacity="0.2" | ||
| d="M28 75.5985C32.6391 75.5985 36.3998 74.3449 36.3998 72.7985C36.3998 71.2521 32.6391 69.9986 28 69.9986C23.3609 69.9986 19.6002 71.2521 19.6002 72.7985C19.6002 74.3449 23.3609 75.5985 28 75.5985Z" | ||
| fill="black" | ||
| /> | ||
| <path | ||
| d="M28 44.7991V69.9986" | ||
| stroke="#3B82F6" | ||
| strokeWidth="3.49993" | ||
| strokeLinecap="round" | ||
| /> | ||
| <path | ||
| d="M28 5.59988C39.1998 5.59988 44.7997 13.9997 44.7997 25.1995C44.7997 36.3993 28 44.7991 28 44.7991C28 44.7991 11.2003 36.3993 11.2003 25.1995C11.2003 13.9997 16.8002 5.59988 28 5.59988Z" | ||
| fill="#60A5FA" | ||
| stroke="#2563EB" | ||
| strokeWidth="2.79994" | ||
| /> | ||
| <path | ||
| opacity="0.9" | ||
| d="M28 30.7994C32.6391 30.7994 36.3998 27.0386 36.3998 22.3995C36.3998 17.7604 32.6391 13.9997 28 13.9997C23.3609 13.9997 19.6002 17.7604 19.6002 22.3995C19.6002 27.0386 23.3609 30.7994 28 30.7994Z" | ||
| fill="white" | ||
| /> | ||
| {/* + 표시를 그룹으로 묶기 */} | ||
| <g className="pin-plus-icon" transform-origin="28 22.3995"> | ||
| {/* 중앙 점 */} | ||
| <path | ||
| d="M28 26.5995C30.3195 26.5995 32.1999 24.7191 32.1999 22.3995C32.1999 20.08 30.3195 18.1996 28 18.1996C25.6804 18.1996 23.8001 20.08 23.8001 22.3995C23.8001 24.7191 25.6804 26.5995 28 26.5995Z" | ||
| fill="#2563EB" | ||
| /> | ||
| {/* 세로선 위 */} | ||
| <path | ||
| d="M28 13.9997V18.1996" | ||
| stroke="#2563EB" | ||
| strokeWidth="2.79994" | ||
| strokeLinecap="round" | ||
| /> | ||
| {/* 세로선 아래 */} | ||
| <path | ||
| d="M28 26.5995V30.7994" | ||
| stroke="#2563EB" | ||
| strokeWidth="2.79994" | ||
| strokeLinecap="round" | ||
| /> | ||
| {/* 가로선 왼쪽 */} | ||
| <path | ||
| d="M19.6002 22.3995H23.8001" | ||
| stroke="#2563EB" | ||
| strokeWidth="2.79994" | ||
| strokeLinecap="round" | ||
| /> | ||
| {/* 가로선 오른쪽 */} | ||
| <path | ||
| d="M32.1999 22.3995H36.3998" | ||
| stroke="#2563EB" | ||
| strokeWidth="2.79994" | ||
| strokeLinecap="round" | ||
| /> | ||
| </g> | ||
| <path | ||
| opacity="0.3" | ||
| d="M22.4001 18.1996C25.4928 18.1996 28 16.3193 28 13.9997C28 11.6802 25.4928 9.7998 22.4001 9.7998C19.3074 9.7998 16.8002 11.6802 16.8002 13.9997C16.8002 16.3193 19.3074 18.1996 22.4001 18.1996Z" | ||
| fill="white" | ||
| /> | ||
| </svg> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| export { default as ErrorIcon } from './ErrorIcon'; | ||
| export { default as RefreshIcon } from './RefreshIcon'; | ||
| export { default as PinMarkerPendingIcon } from './PinMarkerPendingIcon'; | ||
| export { default as PinMarkerCompletedIcon } from './PinMarkerCompletedIcon'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,8 @@ | ||
| export type { IconProps } from './icon'; | ||
| export type { LoadingPageProps, LoadingPageVersion } from './loading'; | ||
| export type { | ||
| Coordinates, | ||
| PinVariant, | ||
| PinMarkerData, | ||
| PinMarkerProps, | ||
| } from './marker'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| export interface Coordinates { | ||
| lat: number; | ||
| lng: number; | ||
| } | ||
|
|
||
| export type PinVariant = 'record' | 'current'; | ||
|
|
||
| export interface PinMarkerData { | ||
| id: string | number; | ||
| position: Coordinates; | ||
| variant: PinVariant; | ||
| } | ||
|
|
||
| export interface PinMarkerProps { | ||
| pin: PinMarkerData; | ||
| isSelected?: boolean; | ||
| onClick?: (id: string | number) => void; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런 svg 설정을
svgr같은 것으로 처리하지 않는 이유가 궁금해요!!Vite 에서 지원해주는
vite-plugin-svgr이런걸 쓰면 최적화도 자동으로 해준다고 본 거 같아서요!!(번들 크기 최소화, tree-shaking 등)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고민을 해보긴 했는데,
개발 편의와 운영 측면에서 svg를 컴포넌트화하는게 더 편해서 이쪽으로 진행하고 있어요!
src아래 자산은 어차피 번들링 대상이라 svgr을 도입한다고 해서 성능/최적화가 결정적으로 달라진다고 보진 않았고,특히 제가 아직 svgr에 익숙하지 못한 탓도 있겠지만,
관리할 아이콘들이 상태별로 내부 요소(ex. 색상 변경)를 제어하는 경우가 많은데.
svgr 같은 경우는
currentColor규칙에 맞춰fill/stroke를 정리하거나 변환 옵션을 관리해서 파일을 붙여야,이런 식의 제어가 가능해지는데.
특정 path만 class를 붙이고 싶어지면 또 다시 svgr 결과물을 내부적으로 편집하고...
요런게 직접 svg를 컴포넌트화했을 때보다 관리가 불편하다고 생각합니다!
이게 더 보기 편한 느낌이라, 현재는 이렇게 진행하고 있습니다!
추후 아이콘 에셋이 대량으로 늘면 svgr을 도입해도 좋을 것 같아요.
숙련도 부족 이슈 ㅠㅠ