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

chore: SegmentedControl, Radio系、ResponseMessageコンポーネントの内部処理を整理する #5385

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

AtsushiM
Copy link
Member

関連URL

概要

変更内容

確認方法

Copy link

pkg-pr-new bot commented Feb 14, 2025

Open in Stackblitz

npm i https://pkg.pr.new/kufu/smarthr-ui@5385

commit: 267083c

Comment on lines -36 to -46
variants: {
disabled: {
true: {
label: 'shr-cursor-[revert] shr-text-disabled',
},
false: {
label: 'shr-cursor-pointer',
box: 'peer-hover:shr-shadow-input-hover',
},
},
},
Copy link
Member Author

Choose a reason for hiding this comment

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

disabledは頻繁に変更される可能性があるため、variantsではなく、元々styleに可変するものとして記述するようにしました

document.addEventListener('keydown', handleKeyDown)

return () => {
document.removeEventListener('keydown', handleKeyDown)
}
}, [handleKeyDown])
}, [isFocused])
Copy link
Member Author

Choose a reason for hiding this comment

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

handleKeydownはuseEffec中でしか利用されていないため、統合しました


const excludesSelected = useMemo(
() => !value || options.every((option) => option.value !== value),
[options, value],
[value, options],
Copy link
Member Author

Choose a reason for hiding this comment

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

正しくmemo化されていれば、valueのほうが頻繁に変更されるため、依存関係チェックの優先度を入れ替えています

@AtsushiM AtsushiM marked this pull request as ready for review February 14, 2025 01:23
@AtsushiM AtsushiM requested a review from a team as a code owner February 14, 2025 01:23
@AtsushiM AtsushiM requested review from moshisora and yuzuru-akiyama and removed request for a team February 14, 2025 01:23
@AtsushiM AtsushiM changed the title Chore: SegmentedControl, Radio系、ResponseMessageコンポーネントの内部処理を整理する chore: SegmentedControl, Radio系、ResponseMessageコンポーネントの内部処理を整理する Feb 14, 2025
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.

1 participant