-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ feat : TagsInput 컴포넌트 작성 - zag 패키지 사용 - 인풋 디자인 * ✨ feat: 제목 입력 인풋 활성,에러 처리 - TitleInput 컴포넌트로 분리 - borderStyle 상수로 분리 * feat: Chip color 에 primary 추가 - size 옵션 medium 을 디폴트로 * 💄 style : border 스타일에 none 추가 * ✨ feat : 밈 입력 폼 상태 생성 * 📦 fix: 콘솔로스 삭제 - borderstyle 수정
- Loading branch information
Showing
36 changed files
with
1,189 additions
and
237 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.5 KB
.yarn/cache/@zag-js-interact-outside-npm-0.22.0-b4b7e97cf0-3fa3d08f4f.zip
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+7.48 KB
.yarn/cache/@zag-js-mutation-observer-npm-0.22.0-8b9fe8b519-0e3b575cdc.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.36 KB
.yarn/cache/@zag-js-text-selection-npm-0.22.0-d750b77b69-71de99233f.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+6.01 KB
.yarn/cache/@zag-js-visually-hidden-npm-0.22.0-c7b467601a-8d16df9a1b.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+11.2 MB
...ypescript-patch-b9b216bc0d-67ca21a387.zip → ...ypescript-patch-38a6667774-d7bdcf5e18.zip
Binary file not shown.
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
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
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,89 @@ | ||
import { normalizeProps, useMachine } from "@zag-js/react"; | ||
import * as tagsInput from "@zag-js/tags-input"; | ||
import type { InputHTMLAttributes } from "react"; | ||
import { useState } from "react"; | ||
|
||
import { Chip } from "@/common/components/Chip"; | ||
import { Icon } from "@/common/components/Icon"; | ||
|
||
import { borderStyle } from "../styles"; | ||
|
||
interface Props extends InputHTMLAttributes<HTMLInputElement> { | ||
word: string; | ||
description: string; | ||
} | ||
|
||
export const TagsInput = (props: Props) => { | ||
const [focus, setFocus] = useState(false); | ||
const [state, send] = useMachine( | ||
tagsInput.machine({ | ||
id: props.placeholder as string, | ||
max: 3, | ||
allowEditTag: false, | ||
validate(details) { | ||
return details.inputValue.length < 11; | ||
}, | ||
}), | ||
); | ||
|
||
const api = tagsInput.connect(state, send, normalizeProps); | ||
const isValidInput = api.inputValue.length < 11; | ||
//TODO: 연관 검색 태그 api 연결 | ||
|
||
return ( | ||
<div className="px-16 text-16-semibold-140 leading-[160%]"> | ||
<div className="flex"> | ||
<div className="w-200" {...api.rootProps}> | ||
<div | ||
className={`flex overflow-x-auto border-b px-4 pb-4 ${ | ||
!isValidInput ? borderStyle.error : focus ? borderStyle.active : borderStyle.normal | ||
}`} | ||
> | ||
<div className="flex gap-4"> | ||
{api.value.map((value, index) => ( | ||
<div | ||
className="cursor-pointer rounded-8 bg-gray-100 p-8 text-14-semibold-140 text-gray-700" | ||
key={index} | ||
> | ||
<div | ||
{...api.getItemProps({ index, value })} | ||
className="flex gap-4 whitespace-nowrap" | ||
> | ||
<span>{value.trim()}</span> | ||
<button {...api.getItemDeleteTriggerProps({ index, value })}> | ||
<Icon id="delete3" name="delete3" /> | ||
</button> | ||
</div> | ||
<input {...api.getItemInputProps({ index, value })} /> | ||
</div> | ||
))} | ||
</div> | ||
<input | ||
{...api.inputProps} | ||
className="ml-4 placeholder:text-gray-500 focus:outline-none" | ||
maxLength={11} | ||
placeholder={api.count ? "" : props.placeholder} | ||
onBlur={() => setFocus(false)} | ||
onFocus={() => setFocus(true)} | ||
/** | ||
* TODO: 자동으로 포커스가 넘어가게 하는 거 구현 | ||
* api.focus 함수 이용 | ||
*/ | ||
/> | ||
</div> | ||
</div> | ||
<span className="text-gray-500 ">{props.word}</span> | ||
</div> | ||
<span className="text-12-regular-160 text-gray-500"> | ||
{isValidInput ? props.description : "태그는 11자로 이내로 작성해주세요"} | ||
</span> | ||
<div css={{ height: "1.6rem" }} /> | ||
{ | ||
/** | ||
* 입력한 태그의 연관 검색 태그 리스트 | ||
*/ | ||
<Chip color="primary" label="박명수" /> | ||
} | ||
</div> | ||
); | ||
}; |
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,45 @@ | ||
import { useState } from "react"; | ||
|
||
import { borderStyle } from "../styles"; | ||
|
||
export const TitleInput = () => { | ||
const [text, setText] = useState<string>(""); | ||
const [focus, setFocus] = useState(false); | ||
|
||
const isValidInput = text.length < 24; | ||
const isFilled = !focus && text.length; | ||
|
||
return ( | ||
<> | ||
<input | ||
maxLength={24} | ||
placeholder=" " | ||
type="text" | ||
value={text} | ||
className={`peer w-full border-b px-4 pb-4 placeholder:text-gray-500 focus:outline-none ${ | ||
!isValidInput | ||
? borderStyle.error | ||
: focus | ||
? borderStyle.active | ||
: isFilled | ||
? borderStyle.none | ||
: borderStyle.normal | ||
}`} | ||
onBlur={() => setFocus(false)} | ||
onChange={(e) => setText(e.target.value)} | ||
onFocus={() => setFocus(true)} | ||
/> | ||
<div className="flex justify-between px-4"> | ||
<span className="text-12-regular-160 text-gray-500"> | ||
{isValidInput | ||
? "밈을 잘 설명할 수 있는 제목을 작성해주세요." | ||
: "24자 미만으로 작성해주세요."} | ||
</span> | ||
<span className="text-12-regular-160 text-gray-500">{text.length}/24</span> | ||
</div> | ||
<span className="pointer-events-none absolute inset-y-0 left-20 text-gray-500 peer-[:not(:placeholder-shown)]:opacity-0"> | ||
제목 작성 <span className="text-secondary-700">*</span> | ||
</span> | ||
</> | ||
); | ||
}; |
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
Oops, something went wrong.