-
Notifications
You must be signed in to change notification settings - Fork 6
Feat: SearchInput 컴포넌트 구현, global.css input outline:none 추가, tailwind.config 반응형 값 수정 #39
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
The head ref may contain hidden characters: "features/SearchInput-ui\uCEF4\uD3EC\uB10C\uD2B8-\uAD6C\uD604"
Changes from all commits
503ab6a
d059cc7
f8af523
bdd0164
cfec09b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { ChangeEvent, FormEvent, useState } from "react"; | ||
| import { useRouter } from "next/router"; | ||
| import Image from "next/image"; | ||
|
|
||
| export const SearchInput = () => { | ||
| const router = useRouter(); | ||
| const [value, setValue] = useState(""); | ||
|
|
||
| const handleChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
| setValue(e.target.value); | ||
| }; | ||
|
|
||
| const handleSubmit = (e: FormEvent<HTMLFormElement>) => { | ||
| e.preventDefault(); | ||
| router.push({ | ||
| pathname: router.pathname, | ||
| query: { ...router.query, search: value }, | ||
| }); | ||
| }; | ||
|
|
||
| return ( | ||
| <form | ||
| onSubmit={handleSubmit} | ||
| className="flex gap-[8px] w-[1024px] h-[54px] items-center px-[16px] py-[15px] bg-gray-100 rounded-[10px] md:w-[704px] md:h-[54px] sm:w-[325px] sm:h-[43px] transition-all" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 혹시 민지님이 작업하신 Container (layout) 에 들어가는거면 w-full 로 해도되지않을까요?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저희는 특정 페이지에서만 쓰이긴 하지만 ui 컴포넌트는 다른 곳에서 금방 쓸 수 있도록 재사용성을 고려해서 만들어야 한다고 생각했습니다! 고로 부모 컴포넌트에 종속적으로 크기를 갖는 게 아닌 이 친구만의 고유한 width가 있어야 한다고 생각했습니다! |
||
| > | ||
| <Image | ||
| src="/icons/search.svg" | ||
| width={16} | ||
| height={16} | ||
| alt="search button" | ||
| /> | ||
| <input | ||
| value={value} | ||
| onChange={handleChange} | ||
| placeholder="링크를 검색해 보세요." | ||
| className="flex-grow bg-transparent placeholder:text-gray-500" | ||
| /> | ||
| </form> | ||
| ); | ||
| }; | ||
|
|
||
| export default SearchInput; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,7 @@ | |
|
|
||
| @font-face { | ||
| font-family: "Pretendard-Regular"; | ||
| src: url("https://fastly.jsdelivr.net/gh/Project-Noonnu/[email protected]/Pretendard-Regular.woff") | ||
| format("woff"); | ||
| src: url("https://fastly.jsdelivr.net/gh/Project-Noonnu/[email protected]/Pretendard-Regular.woff") format("woff"); | ||
| font-weight: 400; | ||
| font-style: normal; | ||
| } | ||
|
|
@@ -36,3 +35,7 @@ button { | |
| cursor: pointer; | ||
| font-family: inherit; | ||
| } | ||
|
|
||
| input { | ||
| outline: none; | ||
| } | ||
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.
입력값을 받을때 debounce를 적용해봐도 좋을것같습니다 !