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

Feature/test settings page #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

eyabc
Copy link
Member

@eyabc eyabc commented Feb 27, 2022

No description provided.

Comment on lines +34 to +35
const isShowOption = (settingOptionType: SettingOptionType) =>
editingState[settingOptionType] !== EditingStateType.EMPTY;
Copy link
Member

Choose a reason for hiding this comment

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

editingState에 대해 메모이제이션을 해도 좋을 것 같음

Copy link
Member Author

Choose a reason for hiding this comment

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

현재 컴포넌트는 state 를 editingState 하나만 쓰이기 때문에 메모이제이션을 사용할 필요가 없음. (useCallback) 그러나
추후 state가 추가가 될 가능성이 있다면 미리 useCallback 을 써주는 것이 좋으나,
하나의 컴포넌트는 최소한의 state 를 가질수있도록 코딩하는 것이 객체지향적으로 좋을듯함.

<Conditional condition={isShowOption(SettingOptionType.POSITION)}>
<SettingPosition
editingStateType={editingState[SettingOptionType.POSITION]}
setEditingState={() => setEditingState(SettingOptionType.POSITION)}
Copy link
Member

Choose a reason for hiding this comment

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

const setOneOfEditingState = useCallback(
  (settingOption: SettingOptionType) =>
  () => setEditingState(settingOptionType),
  [setEditingState]
);

이런 함수를 하나 만들어서 사용하면 좋을 것 같음

return (
<>
<SettingOption
question={"[] 분 동안 몸 풀래요"}
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.

🧐

<>
<SettingOption
question={"[] 분 동안 몸 풀래요"}
selectedOption={(!!selectedTime ? `${selectedTime} 분` : "") + ""}
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
selectedOption={(!!selectedTime ? `${selectedTime} 분` : "") + ""}
selectedOption={String(!!selectedTime ? `${selectedTime} 분` : "")}

이렇게 표현하면 더 명확할듯

Comment on lines 27 to 36
{question.substring(0, question.indexOf(SettingOptionalChar))}
<span>
{editingStateType === EditingStateType.COMPLETE
? selectedOption
: "..."}
</span>
{question.substring(
question.indexOf(SettingOptionalChar) + SettingOptionalChar.length,
question.length
)}
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

Choose a reason for hiding this comment

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

컴포넌트 사용방법이 직관적이지 않은 것 같음

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.

2 participants