Skip to content

SelectionTextfield 컴포넌트 #115

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

Merged
merged 5 commits into from
May 21, 2023
Merged

SelectionTextfield 컴포넌트 #115

merged 5 commits into from
May 21, 2023

Conversation

sumi-0011
Copy link
Member

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

SelectionTextfield 구현
스크린샷 2023-05-21 오후 5 05 21

디자이너 분이 인스타 질문 생성 폼을 보고 만들었다고 합니다! 어떻게 구현하려 했는지, 밑의 동영상을 보면 이해가 쉬울 것 같아요.
참고링크 - 인스타 질문 생성

🎉 변경 사항

  • SelectionTextfield
  • SelectionTextfieldList 스토리북 추가
  • SelectionTextfieldList

🙏 여기는 꼭 봐주세요!

  • 여러 경우의 수를 고려하며 구현하다 보니, props나 상태값이 많아졌습니다. 혹시 개선할 부분이 보이면 알려주세요 🙏

🌄 스크린샷

스크린샷 2023-05-21 오후 5 09 32

@sumi-0011 sumi-0011 added the style Change style or request it label May 21, 2023
@sumi-0011 sumi-0011 linked an issue May 21, 2023 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented May 21, 2023

Codecov Report

Patch coverage has no change and project coverage change: -2.33 ⚠️

Comparison is base (ebaa682) 98.23% compared to head (71219ec) 95.90%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #115      +/-   ##
==========================================
- Coverage   98.23%   95.90%   -2.33%     
==========================================
  Files          35       39       +4     
  Lines         226      244      +18     
  Branches       37       41       +4     
==========================================
+ Hits          222      234      +12     
- Misses          4       10       +6     
Impacted Files Coverage Δ
src/components/icons/XIcon.tsx 50.00% <ø> (ø)

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

Bundle Sizes

Compared against 071cc5d

Route: No significant changes found

Dynamic import: None found.

Copy link
Member

@hyesungoh hyesungoh left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 👍 👍
몇가지 의견만 남겨봤어요 !! 수미님이 이용하시는데에 편하신 방법으로 해주심 좋을 거 같습니다 ! 👍

value: string;
isFocused: boolean;

onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
onChange: ChangeEventHandler<HTMLInputElement>;

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0bb37ed9eab476c136096a576bde7143960f5762/types/cleave.js/react/props.d.ts#L13

요건 어떤가용

Copy link
Member Author

Choose a reason for hiding this comment

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

오 좋아요! 이런 방법도 있군여 ㅎㅎ 감사합니다

const SelectTextFieldList = ({ inputs, basicCount, setInputs, isMultiChoice }: Props) => {
const [focusInput, setFocusInput] = useState<number | null>(null);

const onInputChange = (index: number) => (e: React.ChangeEvent<HTMLInputElement>) => {
Copy link
Member

Choose a reason for hiding this comment

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

이야 커링 👍 👍 🥇


const onItemDelete = (index: number) => {
if (inputs.length - 1 <= basicCount) {
alert(`최소 ${basicCount}개 이상의 옵션을 입력해주세요.`);
Copy link
Member

Choose a reason for hiding this comment

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

요 부분은 나중에 다른 요소(이쁜...) 걸로 대체하면 좋을 거 같네요!

Copy link
Member Author

Choose a reason for hiding this comment

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

넵 맞습니다! 토스트 박스 만들면 그거로 대체할 예정이예요!

inputs: string[];
basicCount: number;

setInputs: (inputs: string[]) => void;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
setInputs: (inputs: string[]) => void;
setInputs: Dispatch<SetStateAction<string[]>>;

string[] 타입의 state의 set 함수를 요구하시길 원하신다면 이렇게 바꾸면 어떨까요 ??

Copy link
Member Author

Choose a reason for hiding this comment

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

이 방식도 알고 있긴 했는데, 이게 나을까요..?
일단 변경하도록 할게요!

Comment on lines +44 to +47
const newInputs = [...inputs];
newInputs.splice(index, 1);

setInputs(newInputs);
Copy link
Member

Choose a reason for hiding this comment

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

위 props Dispatch로 바꾸신다면

setInputs(prev => ... )

이전 값을 보장해주는 방법으로 변경하면 어떨까요?

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented May 21, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 71219ec
Status: ✅  Deploy successful!
Preview URL: https://58f113c5.na-lab.pages.dev
Branch Preview URL: https://feat-selectiontextfield.na-lab.pages.dev

View logs

@github-actions github-actions bot removed the style Change style or request it label May 21, 2023
@sumi-0011 sumi-0011 merged commit 761b41d into main May 21, 2023
@sumi-0011 sumi-0011 deleted the feat/SelectionTextfield branch May 21, 2023 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

SelectionTextfield 제작
3 participants