init: svg sprite 세팅#19
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣ Related Issue
Closes #10
☀️ New-insight
아이콘 목록 자동 생성 스크립트의 역할은 뭘까?(/general-icon-list.ts)
📍svg 아이콘 목록을 자동 생성해주는 스크립트
../assets/svgs 디렉토리 안에 있는 .svg 파일 목록을 읽음
각 파일의 이름(확장자 제외)을 아이콘 이름으로 추출
iconNames 배열과 IconName 타입을 자동으로 생성
../constants/icon-list.ts에 작성
❓왜 icon-list가 필요한가?
아이콘 이름이 모두 나열되어 있으며, IDE 자동 완성에 유리하게 as const로 고정된다.
'ic-arrow-left-18' 같은 문자열만 유효한 name으로 간주하여 실수로 오타를 내거나, 존재하지 않는 아이콘을 넣으면 컴파일 단계에서 타입스크립트가 경고를 해준다.
따라서 타입 안정성, 자동 완성, 유지 보수성 측면에서 icon-list를 작성하는 것이 바람직하다!
💎 PR Point
⭐아이콘 사용 방법
사용 예시!!
name은 svg 파일과 동일하게 지정해주시고, size는 자유롭게 지정 가능합니다.

📸 Screenshot
위와 같이 확인 가능합니다.
Summary by CodeRabbit
New Features
Icon컴포넌트가 추가되었습니다.개선 사항
기타