-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat : dropdown 컴포넌트 제작 * feat : 아이콘 추가, 상태에 따른 색상 변경 * feat : useDropDownState, useClickOutside 추가 * feat: 드롭다운 스토리북 작성, 인터페이스 설명 작성 * feat : 스토리북 a11y false 로, 컴포넌트 인터페이스 수정 * refactor: useFlatChildren 추가, padding 수정 * feat: 예시 추가, import 경로 수정 * refactor : 변경된가이드대로 디자인 변경 * feat : 화살표에 대한 키보드 엔터 동작 추가 * feat: 드롭다운 컨텐츠 영역 absolute 로 조정 * feat: zIndex 토큰 추가, dropdownContent 로 수정 * feat : 필요없는 onMouseEnter 삭제 * refactor : 모바일 여부에 따라 이벤트 타입 변경 * refactor : 코드 리뷰 반영 * refactor : 컴파운드 패턴에서 일반 컴포넌트 방식으로 변경 * feat : 리뷰 반영 * fix : ReactNode 타입 import 하는 것으로 수정 * fix : 순서 수정 * fix : playwright 관련 워크플로우 수정 * feat: playwright 설치
- Loading branch information
Showing
30 changed files
with
816 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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,8 @@ | ||
import { defineTokens } from "@pandacss/dev"; | ||
import { zIndex as wowZIndex } from "wowds-tokens"; | ||
|
||
export const zIndex = defineTokens.zIndex({ | ||
dropdown: { | ||
value: wowZIndex.dropdown, | ||
}, | ||
}); |
This file contains 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,42 @@ | ||
import { forwardRef } from "react"; | ||
import { color } from "wowds-tokens"; | ||
|
||
import type { IconProps } from "@/types/Icon.ts"; | ||
|
||
const DownArrow = forwardRef<SVGSVGElement, IconProps>( | ||
( | ||
{ | ||
className, | ||
width = "20", | ||
height = "20", | ||
viewBox = "0 0 20 20", | ||
stroke = "white", | ||
...rest | ||
}, | ||
ref | ||
) => { | ||
return ( | ||
<svg | ||
aria-label="down-arrow icon" | ||
className={className} | ||
fill="none" | ||
height={height} | ||
ref={ref} | ||
viewBox={viewBox} | ||
width={width} | ||
xmlns="http://www.w3.org/2000/svg" | ||
{...rest} | ||
> | ||
<path | ||
d="M16 9L10 14L4 9" | ||
stroke={color[stroke]} | ||
strokeLinejoin="bevel" | ||
strokeWidth="1.4" | ||
/> | ||
</svg> | ||
); | ||
} | ||
); | ||
|
||
DownArrow.displayName = "DownArrow"; | ||
export default DownArrow; |
This file contains 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,3 @@ | ||
export { default as Check } from "./Check.tsx"; | ||
export { default as DownArrow } from "./DownArrow.tsx"; | ||
export { default as RightArrow } from "./RightArrow.tsx"; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 @@ | ||
export const dropdown = 10; |
This file contains 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 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
193 changes: 193 additions & 0 deletions
193
packages/wow-ui/src/components/DropDown/DropDown.stories.tsx
This file contains 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,193 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { useState } from "react"; | ||
|
||
import DropDown from "@/components/DropDown"; | ||
import DropDownOption from "@/components/DropDown/DropDownOption"; | ||
|
||
const meta = { | ||
title: "UI/DropDown", | ||
component: DropDown, | ||
tags: ["autodocs"], | ||
parameters: { | ||
componentSubtitle: "드롭다운 컴포넌트", | ||
a11y: { | ||
config: { | ||
rules: [{ id: "color-contrast", enabled: false }], | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
children: { | ||
description: "DropDownOption 들을 children 컴포넌트로 받습니다.", | ||
table: { | ||
type: { summary: "ReactNode" }, | ||
}, | ||
control: false, | ||
}, | ||
trigger: { | ||
description: "드롭다운을 열기 위한 외부 트리거 요소입니다.", | ||
table: { | ||
type: { summary: "ReactElement" }, | ||
}, | ||
control: false, | ||
}, | ||
label: { | ||
description: | ||
"외부 트리거를 사용하지 않는 경우 레이블을 사용할 수 있습니다.", | ||
table: { | ||
type: { summary: "ReactNode" }, | ||
}, | ||
control: { type: "text" }, | ||
}, | ||
placeholder: { | ||
description: | ||
"외부 트리거를 사용하지 않는 경우 선택되지 않았을 때 표시되는 플레이스홀더입니다.", | ||
table: { | ||
type: { summary: "string" }, | ||
}, | ||
control: { type: "text" }, | ||
}, | ||
value: { | ||
description: "현재 선택된 값을 나타냅니다.", | ||
table: { | ||
type: { summary: "string" }, | ||
}, | ||
control: { type: "text" }, | ||
}, | ||
defaultValue: { | ||
description: "초기 선택된 값을 나타냅니다.", | ||
table: { | ||
type: { summary: "string" }, | ||
}, | ||
control: { type: "text" }, | ||
}, | ||
onChange: { | ||
description: "값이 변경될 때 호출되는 함수입니다.", | ||
table: { | ||
type: { summary: "(value: string) => void" }, | ||
}, | ||
action: "changed", | ||
}, | ||
}, | ||
} satisfies Meta<typeof DropDown>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Primary: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
<DropDownOption text="option 1" value="option 1" /> | ||
<DropDownOption text="option 2" value="option 2" /> | ||
</> | ||
), | ||
label: "Select an Option", | ||
placeholder: "Please select", | ||
}, | ||
parameters: { | ||
docs: { | ||
description: { | ||
story: "기본적인 드롭다운 컴포넌트입니다.", | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const WithTrigger: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
<DropDownOption text="option 1" value="option 1" /> | ||
<DropDownOption text="option 2" value="option 2" /> | ||
</> | ||
), | ||
trigger: <button>Open Dropdown</button>, | ||
}, | ||
parameters: { | ||
docs: { | ||
description: { | ||
story: "버튼 트리거를 사용하여 드롭다운을 열 수 있는 컴포넌트입니다.", | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const WithDefaultValue: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
<DropDownOption text="option 1" value="option 1" /> | ||
<DropDownOption text="option 2" value="option 2" /> | ||
</> | ||
), | ||
label: "Select an Option", | ||
placeholder: "Please select", | ||
defaultValue: "Option 2", | ||
}, | ||
parameters: { | ||
docs: { | ||
description: { | ||
story: "초기 선택된 값이 설정된 드롭다운 컴포넌트입니다.", | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const ControlledTextField = () => { | ||
const [selectedValue, setSelectedValue] = useState(""); | ||
|
||
const handleChange = (value: string) => { | ||
setSelectedValue(value); | ||
}; | ||
|
||
return ( | ||
<DropDown | ||
label="Select an Option" | ||
placeholder="Choose..." | ||
value={selectedValue} | ||
onChange={handleChange} | ||
> | ||
<DropDownOption text="option 1" value="option 1" /> | ||
<DropDownOption text="option 2" value="option 2" /> | ||
</DropDown> | ||
); | ||
}; | ||
|
||
export const ControlledValue: Story = { | ||
render: () => <ControlledTextField />, | ||
args: {}, | ||
parameters: { | ||
docs: { | ||
description: { | ||
story: "외부에서 제어되는 값을 가진 드롭다운 컴포넌트입니다.", | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const ManyOptions: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
{Array.from({ length: 20 }, (_, index) => ( | ||
<DropDownOption | ||
key={index} | ||
text={`Option ${index + 1}`} | ||
value={`Option ${index + 1}`} | ||
/> | ||
))} | ||
</> | ||
), | ||
label: "Select an Option", | ||
placeholder: "Please select", | ||
}, | ||
parameters: { | ||
docs: { | ||
description: { | ||
story: "많은 옵션을 가진 드롭다운 컴포넌트입니다.", | ||
}, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.