Skip to content
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

Icon Component 생성 #18

Merged
merged 3 commits into from
Dec 7, 2023
Merged

Icon Component 생성 #18

merged 3 commits into from
Dec 7, 2023

Conversation

sumi-0011
Copy link
Member

@sumi-0011 sumi-0011 commented Dec 1, 2023

🤔 해결하려는 문제가 무엇인가요?

Icon Component 생성

🎉 변경 사항

  • 슬랙에서 논의했던 것과 같이 Inline SVG을 이용한 방법을 이용하였어요.
  • LeftArrowIcon 컴포넌트가 있지만, 이것이 아닌 ` 를 이용해 import 해오는 방식을 의도하였습니다.

🙏 여기는 꼭 봐주세요!

  • svg를 추가해주며 기본적인 style 이외에, props를 넘겨 아이콘을 제어할 수 있도록 하였어요.
  • 이를 위해 LeftArrowIcon과 같이 {...props}를 꼭 넣어주어야 합니다.
     <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
    

사용 방법

  • /src/component/Icon 폴더에 해당 아이콘 svg Component를 만들어주세요 (/src/component/Icon/LeftArrowIcon.tsx 참고)
  • /src/component/Icon/index.tsx에서 IconType에 해당 아이콘을 식별할 name을 추가해주세요. (ex, left-arrow)
  • /src/component/Icon/index.tsx의 switch return문 안에 밑과 같이 해당 아이콘을 추가해주세요.
    case 'left-arrow':
        return <LeftArrowIcon {...props} />;
    

📚 참고

@sumi-0011 sumi-0011 self-assigned this Dec 1, 2023
@sumi-0011 sumi-0011 linked an issue Dec 1, 2023 that may be closed by this pull request
@sumi-0011 sumi-0011 marked this pull request as ready for review December 1, 2023 16:24
@sumi-0011 sumi-0011 changed the title ✨Icon Component 생성 Icon Component 생성 Dec 1, 2023
export default function Icon({ name, ...props }: Props) {
switch (name) {
case 'left-arrow':
return <LeftArrowIcon {...props} />;
Copy link
Collaborator

Choose a reason for hiding this comment

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

나중에 디자인 시스템 나오면 size도 타입관리하면 좋을듯!

Copy link
Member Author

Choose a reason for hiding this comment

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

디자인 시스템이 나오면 수정할 수 있게 이슈에 추가해둘게여

<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
<path
d="M13.7139 17.4273L6.43555 10.149L13.7139 2.87012"
stroke={props.color ?? '#B0B8C1'}
Copy link
Collaborator

Choose a reason for hiding this comment

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

컬러변경 굿...
마이너) svg 마다 defaultcolor 가 다르게 존재할까요?

src/components/Header.tsx Outdated Show resolved Hide resolved
Copy link
Member

@JUNOSHON JUNOSHON left a comment

Choose a reason for hiding this comment

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

아이콘 사용하는 방법 배워갑니다..!

Copy link

vercel bot commented Dec 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
10mm-client-web 🛑 Canceled (Inspect) Dec 7, 2023 11:10am

# Conflicts:
#	src/components/Header.tsx
#	src/styled-system/tokens/tokens.d.ts
#	src/styled-system/types/prop-type.d.ts
@sumi-0011 sumi-0011 merged commit b9723f6 into develop Dec 7, 2023
3 checks passed
Copy link
Contributor

github-actions bot commented Dec 7, 2023

@JUNOSHON JUNOSHON deleted the feat/icon branch December 9, 2023 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] Icon Component 구현
4 participants