diff --git a/next.config.ts b/next.config.ts index d6f18b10..51f71152 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,15 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - turbopack: {}, + turbopack: { + rules: { + "*.svg": { + loaders: ["@svgr/webpack"], + as: "*.js", + }, + }, + }, + async rewrites() { return [ { @@ -13,7 +21,8 @@ const nextConfig: NextConfig = { webpack(config) { config.module.rules.push({ - test: /\.svg$/, + test: /\.svg$/i, + issuer: /\.[jt]sx?$/, use: ["@svgr/webpack"], }); return config; diff --git a/src/shared/ui/button.tsx b/src/shared/ui/button.tsx index 80e0df84..266363a8 100644 --- a/src/shared/ui/button.tsx +++ b/src/shared/ui/button.tsx @@ -28,7 +28,6 @@ const variants: Record = { ), secondary: cn( "px-3 bg-gray-50 text-gray-700 font-semibold shadow-button", - "border border-border-secondary", "hover:bg-gray-100 hover:shadow-button-hover", "disabled:bg-gray-bg disabled:text-gray-100 disabled:border-gray-100", ), diff --git a/src/shared/ui/client-select.tsx b/src/shared/ui/client-select.tsx deleted file mode 100644 index 702edab6..00000000 --- a/src/shared/ui/client-select.tsx +++ /dev/null @@ -1,21 +0,0 @@ -"use client"; - -import Select, { type SelectProps } from "@/src/shared/ui/select"; - -type ClientSelectProps = SelectProps & { - onValueChange?: (value: string) => void; -}; - -export default function ClientSelect({ - onValueChange, - ...props -}: ClientSelectProps) { - return ( - - {placeholder ? ( - - ) : null} +
+ + {hasChildren + ? children + : options?.map((option) => ( + + ))} + + + {isOpen ? ( + + ) : ( + + )} +
); } - -// TODO 디자인 도입 시 변경 예정 diff --git a/src/shared/ui/tooltip.tsx b/src/shared/ui/tooltip.tsx new file mode 100644 index 00000000..0076796f --- /dev/null +++ b/src/shared/ui/tooltip.tsx @@ -0,0 +1,56 @@ +"use client"; + +import { useState } from "react"; +import cn from "@/src/shared/lib/cn"; + +type TooltipProps = { + content: React.ReactNode; + children: React.ReactNode; + className?: string; +}; + +export default function Tooltip({ + content, + children, + className, +}: TooltipProps) { + const [open, setOpen] = useState(false); + + return ( + setOpen(true)} + onMouseLeave={() => setOpen(false)} + onFocus={() => setOpen(true)} + onBlur={() => setOpen(false)} + > + {children} + + {open && ( + + {content} + + + + )} + + ); +} diff --git a/src/stories/Popover.stories.tsx b/src/stories/Popover.stories.tsx index d7991a52..835c1bf6 100644 --- a/src/stories/Popover.stories.tsx +++ b/src/stories/Popover.stories.tsx @@ -8,111 +8,94 @@ const meta: Meta = { component: Popover, tags: ["autodocs"], argTypes: { - align: { - control: "select", - options: ["left", "center", "right"], - description: "트리거 기준 팝오버 정렬 위치", - }, - center: { - control: "boolean", - description: "팝오버를 화면 중앙에 표시", - }, isOpen: { - control: false, - description: "Controlled 모드에서 팝오버 열림 상태", + control: "boolean", + description: "팝업의 표시 여부", }, onClose: { - action: "close", - description: "팝오버가 닫힐 때 호출", + action: "closed", + description: "배경이나 ESC 클릭 시 호출되는 함수", + }, + className: { + control: "text", + description: "높이(height) 등 디자인 수정을 위한 추가 클래스", }, }, + decorators: [ + (Story) => ( +
+ +
+ ), + ], }; export default meta; type Story = StoryObj; -export const Default: Story = { - args: { - trigger: , - children: ( -
- 가장 기본적인 팝오버 내용입니다. -
- ), - align: "left", - }, -}; - -export const DetailedMenu: Story = { +export const LogoutType: Story = { args: { - trigger: ( - - 도움말 확인하기 - - ), + isOpen: true, + className: "h-[350px]", children: ( -
-
-

정책 신청 가이드

+ <> +
+

로그아웃 하시겠습니까?

+

+ 로그아웃 시 맞춤 공고 확인 및
+ 커뮤니티 이용이 제한될 수 있습니다. +

-

- 거주 지역과 연령을 입력하면{" "} - - 맞춤형 정부 지원금 - {" "} - 목록을 확인할 수 있습니다. -

- -
+
+ +
+ ), - align: "left", }, }; -export const Centered: Story = { +/** + * 2. 공유하기 팝업 디자인 (Height 206px) + */ +export const ShareType: Story = { args: { - trigger: , - center: true, + isOpen: true, + className: "h-[206px]", children: ( -
-

화면 중앙 팝오버

-

- 기존 Popover API를 유지하면서 -
- 중앙 배치 옵션만 추가했습니다. -

-
+ <> +
+

공유하기

+

+ 이 공고를 친구에게 공유해보세요. +

+
+
+ +
+ ), }, }; -export const Controlled: Story = { +export const Interactive: Story = { render: () => { const [isOpen, setIsOpen] = useState(false); - return ( -
-

- 외부 상태로 제어됨: {isOpen ? "열림" : "닫힘"} -

- +
+ setIsOpen(false)} - trigger={ - - } - center + className="h-[250px]" > -
-

Controlled Popover (기존 API 기반)

- +
+

인터랙티브 팝업입니다.

+
); diff --git a/src/stories/Select.stories.tsx b/src/stories/Select.stories.tsx index b717b4c1..138a8c64 100644 --- a/src/stories/Select.stories.tsx +++ b/src/stories/Select.stories.tsx @@ -1,6 +1,5 @@ import type { Meta, StoryObj } from "@storybook/react"; import Select from "@/src/shared/ui/select"; -import ClientSelect from "@/src/shared/ui/client-select"; const meta: Meta = { title: "ui-kit/Select", @@ -47,19 +46,3 @@ export const Disabled: Story = { disabled: true, }, }; - -/* ---------------- Client Select ---------------- */ - -export const ClientSelectExample: StoryObj = { - render: () => ( - { - console.log("선택된 값:", value); - }} - /> - ), - name: "ClientSelect (onValueChange)", -};