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

[Feat/#32] Input 공통 컴포넌트 제작 #47

Merged
merged 21 commits into from
Jul 7, 2024
Merged

Conversation

imddoy
Copy link
Contributor

@imddoy imddoy commented Jul 6, 2024

📌 관련 이슈번호

🎟️ PR 유형

어떤 변경 사항이 있나요?

  • 새 기능 추가
  • 버그 수정
  • CSS 등 사용자 UI 디자인 변경
  • 리팩토링

✅ Key Changes

이번 PR에서 작업한 내용을 간략히 설명해주세요

  1. 공통 컴포넌트 Input 제작(textfield, textarea)
  2. 스토리북 전역 theme 설정

📢 To Reviewers

  • 컨벤션 맞춘다고 맞춘건데 못 맞춘 부분 있을 것 같아요...아마... 만약 이상하다 싶으면 바로 지적해주세요!
  • 컴포넌트 texfield랑 textarea 폴더 2개로 나눴습니다. input이랑 textarea로 태그가 다릅니다!!
  • 디자인에 맞게 default textfield만 입력하면 x버튼 나오고 누르면 입력값 사라져요.
  • utils에 useInputFilter 파일 만들어서 정규표현식 만들었습니다. 인풋 태그 만들때 filter를 prop으로 넘겨주세요.
  • prop이 너무 많은 것 같기도 하고... 코드 분리가 잘 안된 것 같기도 하고.... 컴포넌트 만드는게 제일 어렵네요ㅜㅜㅜ 많은 피드백 부탁드립니다.
  • 컴포넌트 사용은 interface로 prop 타입 정의한거 참고해도 좋고,,, test 페이지 봐주셔도 좋고,,,,, story 파일 봐주셔도 됩니다. 그런데 아마 페이지랑 story 보는게 제일 보기 편할 것 같아요.
  • 그리고 @ 이거 alias가 story에서는 안먹혀서 ./../ 이렇게 상대경로로 접근했습니다.

📸 스크린샷

image
스토리 설명하자면

  • textarea에서 cap on은 글자수 제한 있는 버전, off는 글자수 제한 없는 버전입니다.
  • textfield에서 default가 가로로 긴 버전 narrow가 좁은 버전입니다.
  • time은 러닝타임
  • ticket은 매 수
  • amount는 가격
  • phone은 전화번호

리뷰에 올라오는 스토리북 사이트 들어가서 테스트하고 이슈 알려주세요!!

image
이건 테스트 페이지 화면 개발환경입니다.

🔗 참고 자료

✨스토리북 전역 theme 설정 트슈 작성했어요

@github-actions github-actions bot added the ✨ FEAT 기능 구현 label Jul 6, 2024
Copy link

github-actions bot commented Jul 6, 2024

PR 작성하느라 고생 많았어요!! 라벨 잘 지정되었는지 확인 한 번 해 주기 🫶

Copy link

github-actions bot commented Jul 6, 2024

Copy link

github-actions bot commented Jul 7, 2024

Copy link

github-actions bot commented Jul 7, 2024

Copy link
Member

@pepperdad pepperdad left a comment

Choose a reason for hiding this comment

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

채현이 고생해써 ~~ !!!
스토리북도 했네 ㅎㅎㅎ

근데 우리가 컴포넌트를 만드는 거니까 state를 컴포넌트 내부에 선언하는 게 아니라 밖에서 선언하고 값을 가질 수 있게 구조를 바꿔야할 것 같아!

관련해서 작성했으니까 확인하고 수정해봐!
https://jiwoothejay.notion.site/Input-21c0e54982644c3e9286178eee1f2527?pvs=25

Comment on lines 12 to 33
export const TextFieldInput = styled.input`
box-sizing: border-box;
width: 100%;
height: 4.8rem;
padding: 0 1.6rem;

color: ${({ theme }) => theme.colors.gray_0};

background: ${({ theme }) => theme.colors.gray_800};
border: none;
border-radius: 0.6rem;

${({ theme }) => theme.fonts["body2-normal-medi"]};

&::placeholder {
color: ${({ theme }) => theme.colors.gray_600};
}

&:focus {
border: 1px solid ${({ theme }) => theme.colors.gray_0};
}
`;
Copy link
Member

Choose a reason for hiding this comment

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

https://github.com/TEAM-BEAT/BEAT-Client/assets/58854041/b781699d-4782-4ea7-9eb5-fee13d3e303c
p2) 지금 위 영상처럼 focus 됐을 경우에 border 때문에 input이 조금 밀리고 있어요!
이 부분은 border 색상에 transparent 주면 될 것 같습니다! 그리고 전체 태그들이 이미 border-box라서 이 부분은 필요없어 보여요!
TextArea도 똑같은 문제가 발생해서 따로 리뷰는 안 달게요! 수정 부탁드립니다 ㅎㅎ

Suggested change
export const TextFieldInput = styled.input`
box-sizing: border-box;
width: 100%;
height: 4.8rem;
padding: 0 1.6rem;
color: ${({ theme }) => theme.colors.gray_0};
background: ${({ theme }) => theme.colors.gray_800};
border: none;
border-radius: 0.6rem;
${({ theme }) => theme.fonts["body2-normal-medi"]};
&::placeholder {
color: ${({ theme }) => theme.colors.gray_600};
}
&:focus {
border: 1px solid ${({ theme }) => theme.colors.gray_0};
}
`;
export const TextFieldInput = styled.input`
width: 100%;
height: 4.8rem;
padding: 0 1.6rem;
color: ${({ theme }) => theme.colors.gray_0};
background: ${({ theme }) => theme.colors.gray_800};
border: 1px solid transparent;
border-radius: 0.6rem;
${({ theme }) => theme.fonts["body2-normal-medi"]};
&::placeholder {
color: ${({ theme }) => theme.colors.gray_600};
}
&:focus {
border: 1px solid ${({ theme }) => theme.colors.gray_0};
}
`;

Comment on lines 18 to 24
<S.TextAreaWrapper>
<S.TextAreaInput
value={inputValue}
onChange={handleOnInput}
maxLength={maxLength}
placeholder={placeholder}
></S.TextAreaInput>
Copy link
Member

Choose a reason for hiding this comment

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

p4) 여기 안에 들어가는 content가 없어서 self closing 태그로 바꾸면 좋을 것 같아요! Input도 마찬가지로!

Suggested change
<S.TextAreaWrapper>
<S.TextAreaInput
value={inputValue}
onChange={handleOnInput}
maxLength={maxLength}
placeholder={placeholder}
></S.TextAreaInput>
<S.TextAreaWrapper>
<S.TextAreaInput
value={inputValue}
onChange={handleOnInput}
maxLength={maxLength}
placeholder={placeholder}
/>

maxLength?: number;
placeholder: string;
narrow?: false | true;
unit?: "time" | "ticket" | "amount"; // 단위 : "분", "매", "원"
Copy link
Member

Choose a reason for hiding this comment

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

p5) 주석 최고 ㅎㅎ

Comment on lines 5 to 12
export const TextFieldLayout = styled.section<{ narrow?: false | true }>`
position: relative;
width: ${({ narrow }) => (narrow ? "13.6rem" : "32.7rem")};
`;
export const TextFieldWrapper = styled.article`
${Generators.flexGenerator("row", "center", "center")}
`;
export const TextFieldInput = styled.input`
Copy link
Member

Choose a reason for hiding this comment

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

p4) 여기 가독성 좋게 한 칸씩 띄어서 써주면 좋을 것 같아요!

Suggested change
export const TextFieldLayout = styled.section<{ narrow?: false | true }>`
position: relative;
width: ${({ narrow }) => (narrow ? "13.6rem" : "32.7rem")};
`;
export const TextFieldWrapper = styled.article`
${Generators.flexGenerator("row", "center", "center")}
`;
export const TextFieldInput = styled.input`
export const TextFieldLayout = styled.section<{ narrow?: false | true }>`
position: relative;
width: ${({ narrow }) => (narrow ? "13.6rem" : "32.7rem")};
`;
export const TextFieldWrapper = styled.article`
${Generators.flexGenerator("row", "center", "center")}
`;
export const TextFieldInput = styled.input`

Copy link
Member

Choose a reason for hiding this comment

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

p4) 유틸함수까지!!! 파일명 useInputFilter로 바꿔줘!

Copy link
Member

Choose a reason for hiding this comment

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

p5) ⭐️⭐️

Copy link

github-actions bot commented Jul 7, 2024

Copy link

github-actions bot commented Jul 7, 2024

…to feat/#32/CommonInput

; Conflicts:
;	src/pages/test/TestPage.tsx
Copy link

sonarqubecloud bot commented Jul 7, 2024

Copy link

github-actions bot commented Jul 7, 2024

@pepperdad pepperdad merged commit c93b0cf into develop Jul 7, 2024
3 of 4 checks passed
@sinji2102 sinji2102 deleted the feat/#32/CommonInput branch December 16, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ FEAT 기능 구현
Projects
Status: 🎉Done
Development

Successfully merging this pull request may close these issues.

[ Feat ] Input 공통 컴포넌트 추가
2 participants