Skip to content

[Feat] SearchBar 컴포넌트 제작#35

Merged
YeBeenChoi merged 16 commits into
mainfrom
22-feat/SearchBar-컴포넌트-제작
Jan 18, 2026

Hidden character warning

The head ref may contain hidden characters: "22-feat/SearchBar-\ucef4\ud3ec\ub10c\ud2b8-\uc81c\uc791"
Merged

[Feat] SearchBar 컴포넌트 제작#35
YeBeenChoi merged 16 commits into
mainfrom
22-feat/SearchBar-컴포넌트-제작

Conversation

@YeBeenChoi

Copy link
Copy Markdown
Collaborator

✨ 주요 변경사항

  • SearchBar 컴포넌트 구현 및 상태 스타일 적용
  • Playground에 SearchBar 예시 추가

📝 작업 상세 내용

  • 입력값 유무에 따라 default/filled 상태 전환
  • 상태별 배경/텍스트/아이콘 컬러와 radius 토큰 적용
  • 검색 아이콘은 currentColor로 설정해 상태 색상이 반영되도록 구현

✅ 체크리스트

  • PR 본문에 Close #번호 추가
  • 불필요한 주석, 디버깅 코드 제거
  • 기능 테스트 및 정상 동작 확인
  • 커밋컨벤션 / 코드컨벤션 준수

📸 스크린샷 (선택)

SearchBar.mov

🔍 기타 참고사항

피그마에는 filled 상태에만 디자인이 바뀌도록 정의되어 있는데, UX 관점에서 focus 상태에서도 디자인이 filled와 동일하게 바뀌는 게 더 좋을 것 같다는 생각이 들었습니다...!
현재는 요구사항대로 filled 상태에만 디자인이 변경되도록 구현했는데, 다른 분들은 어떻게 생각하시는지 궁금합니다!


🔗 관련 이슈

@github-actions github-actions Bot added the ✨Feature 새로운 기능 label Jan 16, 2026
@github-actions

Copy link
Copy Markdown

PR 검증 결과

TypeScript: 통과
ESLint: 통과
Prettier: 통과
Test: 통과
Build: 성공
Build Size: 2MB

@KyeongJooni KyeongJooni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다! 포커스 스타일도 접근성을 위해 추가하면 좋을 것 같아요!

Comment on lines +17 to +30
/**
* true면 입력값 유무로 default/filled 자동 전환
* (요구사항: default로 보이다가 입력하면 filled)
*/
autoFilled?: boolean;

/**
* 강제로 상태 고정하고 싶을 때만 사용 (기본은 auto)
*/
state?: SearchBarState;

/**
* wrapper에 추가 클래스 주고 싶을 때
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

주석 정리 해주시거나 불필요한 주석은 삭제해주세요!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 삭제했습니다!

Comment thread src/shared/ui/SearchBar/SearchBar.tsx Outdated
const [innerValue, setInnerValue] = useState<string>(defaultValue ?? '');
const currentValue = isControlled ? value : innerValue;

const hasValue = (currentValue ?? '').trim().length > 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금 스페이스 쭉 입력해도 trim 때문에 기본 상태로 보일 것 같은데 확인 부탁드립니다!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정했습니다!

Comment thread src/shared/ui/SearchBar/SearchBar.tsx Outdated
onChange,
...rest
}: SearchBarProps) => {
const isControlled = value !== undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제어/비제어 모드를 이렇게 구현해주신 이유가 있을까요? useRef 사용해서 고정하여 구현하면 좀 더 안정적일 것 같습니다!

@YeBeenChoi YeBeenChoi Jan 18, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 감사합니다! SearchBar.tsx 파일을 리팩토링하였는데, filled 상태에 따른 스타일 변경 때문에 value 추적이 필요해서 useRef 대신 useState로 처리했습니다! 컴포넌트 규모가 작아 렌더링 코스트가 크지 않다고 판단해 해당 방식으로 구현하였는데, 제어/비제어 안정성 관점에서 useRef로 처리하는 게 더 낫다면 그 방향으로 수정하겠습니다!

@jwj0620gcu

Copy link
Copy Markdown
Collaborator

예빔님 수고하셨습니다! 저는 개인적으로 focus 상태에서도 디자인이 똑같이 filled로 바뀌는 게 더 좋을 것 같습니다...!

@github-actions

Copy link
Copy Markdown

PR 검증 결과

TypeScript: 통과
⚠️ ESLint: 문제 발견
Prettier: 포맷 필요
Test: 실패
Build: 실패

ESLint 상세

  • Errors: 1
  • Warnings: 0

src/shared/assets/icons/index.ts

  • Error (Line 1): 'CaretDownMdIcon' is defined but never used. unused-imports/no-unused-imports

@github-actions

Copy link
Copy Markdown

PR 검증 결과

TypeScript: 통과
ESLint: 통과
Prettier: 통과
Test: 통과
Build: 성공
Build Size: 3MB

@KyeongJooni KyeongJooni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다! :)

@YeBeenChoi
YeBeenChoi merged commit ac29503 into main Jan 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨Feature 새로운 기능

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] #22 - SearchBar 컴포넌트 제작

3 participants