diff --git a/src/assets/icons/index.tsx b/src/assets/icons/index.tsx index 9e43f46..764c7e4 100644 --- a/src/assets/icons/index.tsx +++ b/src/assets/icons/index.tsx @@ -16,6 +16,7 @@ import KakaoLogin from './kakao-login.svg?react'; import Link from './link.svg?react'; import Location from './location.svg?react'; import Map from './map.svg?react'; +import Marker from './marker.svg?react'; import NaverLogin from './naver-login.svg?react'; import Other from './other.svg?react'; import Public from './public.svg?react'; @@ -38,6 +39,7 @@ export const Icons = { link: Link, map: Map, location: Location, + marker: Marker, kakaoLogin: KakaoLogin, naverLogin: NaverLogin, findy1: Findy1, diff --git a/src/assets/icons/marker.svg b/src/assets/icons/marker.svg new file mode 100644 index 0000000..74fd33f --- /dev/null +++ b/src/assets/icons/marker.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/components/common/.gitkeep b/src/components/common/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/common/Marker/Marker.stories.tsx b/src/components/common/Marker/Marker.stories.tsx new file mode 100644 index 0000000..04528af --- /dev/null +++ b/src/components/common/Marker/Marker.stories.tsx @@ -0,0 +1,39 @@ +/* eslint-disable no-restricted-exports */ +import type { Meta, StoryObj } from '@storybook/react'; + +import { MARKER_CATEGORIES } from '@/constants/categories'; + +import { Marker } from '.'; + +const meta = { + title: 'components/common/Marker', + component: Marker, + tags: ['autodocs'], +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Basic: Story = { + args: { + categoryName: 'restaurant', + }, + argTypes: { + categoryName: { control: { type: 'select' }, options: MARKER_CATEGORIES }, + }, + render: (args) => { + return ; + }, +}; + +export const ALL: Story = { + render: () => { + return ( + <> + {MARKER_CATEGORIES.map((item) => ( + + ))} + + ); + }, +}; diff --git a/src/components/common/Marker/Marker.types.ts b/src/components/common/Marker/Marker.types.ts new file mode 100644 index 0000000..f8fba10 --- /dev/null +++ b/src/components/common/Marker/Marker.types.ts @@ -0,0 +1,10 @@ +import { ComponentPropsWithoutRef } from 'react'; + +import { MarkerCategory } from '@/constants/categories'; + +export type Props = { + /** + * category name to be displayed. + */ + categoryName: MarkerCategory; +} & ComponentPropsWithoutRef<'button'>; diff --git a/src/components/common/Marker/index.tsx b/src/components/common/Marker/index.tsx new file mode 100644 index 0000000..5d7036a --- /dev/null +++ b/src/components/common/Marker/index.tsx @@ -0,0 +1,30 @@ +import MarkerIcon from '@/assets/icons/marker.svg'; + +import { Props } from './Marker.types'; + +import { Icon } from '../Icon'; + +export const Marker = ({ categoryName, ...props }: Props) => { + const ICON_SIZE = 35; + const ICON_POSITIONS = { + default: { left: '51%', top: '1/2' }, + restaurant: { left: '51%', top: '[55%]' }, + }; + + const position = + categoryName === 'restaurant' ? ICON_POSITIONS.restaurant : ICON_POSITIONS.default; + return ( + + ); +}; diff --git a/src/constants/categories.ts b/src/constants/categories.ts new file mode 100644 index 0000000..fdde898 --- /dev/null +++ b/src/constants/categories.ts @@ -0,0 +1,11 @@ +export const MARKER_CATEGORIES = [ + 'restaurant', + 'cafe', + 'bar', + 'shopping', + 'travel', + 'public', + 'hospital', + 'other', +] as const; +export type MarkerCategory = (typeof MARKER_CATEGORIES)[number];