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: SingleComboBoxの内部ロジックを整理する #5337

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
3bb40d3
chore: decoratorsのデフォルト文字列の持ち方を調整する
AtsushiM Jan 23, 2025
5ef9eda
chore: DecoratorsTypeの設置場所を移動
AtsushiM Jan 23, 2025
0d284e1
chore: useDecoratorsを定義
AtsushiM Jan 23, 2025
139d213
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Jan 24, 2025
7f05277
chore: useDecoratorsにわたすgenericsを調整
AtsushiM Jan 24, 2025
10baf9d
chore: libs/decorator を hooks/useDecorators に移動
AtsushiM Jan 24, 2025
660292c
chore: fix stories
AtsushiM Jan 24, 2025
485eebb
chore: ComboBoxのuseOptionsのisInputValueAddableの生成ロジックを整理する
AtsushiM Jan 25, 2025
ff3c853
chore: ComboBoxのuseOptionsのgetOptionIdは関数化する意味がないため解除
AtsushiM Jan 25, 2025
a4f8957
chore: ComboBoxのuseOptions内にexistedOptionsを定義
AtsushiM Jan 25, 2025
c515bea
chore: ComboBoxのuseOptions内のaddingOptionを切り出してmemo化
AtsushiM Jan 25, 2025
e69c2d1
chore: ComboBoxのuseOptions内のisInputValueAddableを整理
AtsushiM Jan 25, 2025
2f619c4
chore: ComboBoxのuseOptions内のoptions生成方法を整理
AtsushiM Jan 25, 2025
3838a06
chore: ComboBoxのuseOptionsでisSelectedのmemo効率を良くするため、hookを分割する
AtsushiM Jan 25, 2025
0df395e
chore: ComboBoxのuseOptionsの型を整理
AtsushiM Jan 25, 2025
430d1bf
chore: ComboBoxのuseOptionsの呼び出し方を最適化
AtsushiM Jan 25, 2025
ffb3ad7
chore: ComboBoxのuseOptionsのテストを修正
AtsushiM Jan 25, 2025
d32fe62
chore: ComboBoxのuseListBox内でsetTriggerWidth(0)の初期化処理は実施済みのため削除
AtsushiM Jan 26, 2025
db14a34
chore: ComboBoxのuseListBox内でisActiveTopOutside,isActiveBottomOutsideの…
AtsushiM Jan 26, 2025
70ca015
chore: ComboBoxのuseListBoxでhandleKeyDownの条件分岐を最適化
AtsushiM Jan 26, 2025
b262f5d
chore: ComboBoxのuseListBoxでhandleAddのmemoを最適化する
AtsushiM Jan 26, 2025
1f30d3a
chore: ComboBoxのuseListBoxでstyle, classNameのmemo化を分離する
AtsushiM Jan 26, 2025
b818a9d
chore: ComboBoxのuseListBoxでstyleの生成を完全にmemo化
AtsushiM Jan 26, 2025
5187612
Merge branch 'chore-add-use-decorators' into chore-refactoring-ComboB…
AtsushiM Jan 26, 2025
d1a6ead
chore: ComboBoxのuseListBoxでdecoratorsをmemo化
AtsushiM Jan 26, 2025
45437c2
chore: ComboBoxのuseListBoxでloadingTextの表示ロジックを調整
AtsushiM Jan 26, 2025
de097ed
chore: fix ci
AtsushiM Jan 27, 2025
0969d97
chore: ComboBox/useLitBoxのkeyの判定を正規表現に行う
AtsushiM Jan 27, 2025
b8d522d
chore: ComboBox/useLitBoxのhookの依存関係を整理
AtsushiM Jan 27, 2025
d85caa1
chore: ListBoxItemButtonのisActiveは常にbooleanなので、余計なboolean化を削除
AtsushiM Jan 27, 2025
b83befc
chore: ListBoxItemButtonの最終出力で共通の属性を書き出す
AtsushiM Jan 27, 2025
0e5373d
chore: ListBoxItemButtonのMemoizedNewIconWithTextを切り出す
AtsushiM Jan 27, 2025
c3bd8e4
chore: SingleComboBoxのif条件を整理
AtsushiM Jan 27, 2025
3e83dd2
chore: SingleComboBoxのonFocusには常に関数を渡す必要がないため、handleFocusのmemo化を解除
AtsushiM Jan 27, 2025
a417dd0
chore: SingleComboBoxのuseClickのmemoを効率化
AtsushiM Jan 27, 2025
eae4db0
chore: SingleComboBoxでselectDefaultItem内部メソッドを定義
AtsushiM Jan 27, 2025
332583c
chore: SingleComboBoxのstyle, className生成時のmemo化を分離する
AtsushiM Jan 27, 2025
8295eaf
chore: SingleComboBoxのstylesの生成を最適化
AtsushiM Jan 27, 2025
cd1a914
Merge branch 'chore-add-use-decorators' into chore-refactoring-Single…
AtsushiM Jan 27, 2025
08c9f52
chore: SingleComboBoxのdecoratorsの扱いを最適化
AtsushiM Jan 27, 2025
549eec5
chore: SingleComboBoxのcaretに対してrole="presentation"を設定し、装飾的な要素であることを伝える
AtsushiM Jan 27, 2025
74f1c62
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Jan 28, 2025
ee9486f
Merge branch 'chore-add-use-decorators' into chore-refactoring-ComboB…
AtsushiM Jan 28, 2025
7d25dcf
Merge branch 'chore-add-use-decorators' into chore-refactoring-Single…
AtsushiM Jan 28, 2025
0a7be39
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Feb 6, 2025
b40300f
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Feb 6, 2025
27dd66b
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Feb 6, 2025
772b7e3
chore: style -> className
AtsushiM Feb 6, 2025
ca5e096
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Feb 11, 2025
52634b8
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Feb 11, 2025
a2d123d
chore: ListBoxItemButtonでkey設定は不要
AtsushiM Feb 11, 2025
6abd1cc
chore: ListBoxItemButtonのisActiveの役割をactiveRefで補う
AtsushiM Feb 11, 2025
5ba7ea8
chore: ListBoxItemButtonの内部分岐に合わせてコンポーネントを分割する
AtsushiM Feb 12, 2025
9846bfc
chore: ListBoxItemButtonのclassName生成ロジックを整理
AtsushiM Feb 12, 2025
e55f36c
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Feb 12, 2025
36830a3
Merge branch 'chore-refactoring-ComboBox-useListBox' into chore-refac…
AtsushiM Feb 12, 2025
adccfab
chore: SingleComboboxのclassName生成を調整
AtsushiM Feb 12, 2025
368d19b
chore: setterはmemo化の依存関係に含めなくて良いため調整
AtsushiM Feb 12, 2025
7643b2c
chore: 属性の並び順を調整
AtsushiM Feb 12, 2025
ca7f518
chore: 配列での条件分岐を正規表現で行う
AtsushiM Feb 12, 2025
cb79af1
chore: ListBoxItemButtonのclassName生成ロジックを整理
AtsushiM Feb 12, 2025
13f3c86
Merge branch 'chore-refactoring-ComboBox-useListBox' into chore-refac…
AtsushiM Feb 12, 2025
f16d2e9
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Feb 12, 2025
404ae3e
Merge branch 'chore-refactoring-ComboBox-useOptions' into chore-refac…
AtsushiM Feb 12, 2025
d7f3973
fix: StepFormDialogにuseResponseMessageを適用する
AtsushiM Feb 14, 2025
8d6f263
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Feb 16, 2025
417fdff
Merge branch 'fix-response-message' into chore-refactoring-SingleComb…
AtsushiM Feb 16, 2025
03f7789
Merge branch 'master' of https://github.com/kufu/smarthr-ui into chor…
AtsushiM Feb 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { type RefObject, useCallback, useMemo } from 'react'
import React, { type ReactNode, type RefObject, useCallback, useMemo } from 'react'
import { tv } from 'tailwind-variants'

import { FaPlusCircleIcon } from '../Icon'
Expand Down Expand Up @@ -92,13 +92,15 @@ const AddButton = <T,>({
onMouseOver={onMouseOver}
className={className}
>
<FaPlusCircleIcon
color="TEXT_LINK"
text={<Text color="TEXT_LINK">「{option.item.label}」を追加</Text>}
/>
<MemoizedNewIconWithText label={option.item.label} />
</button>
)
}

const MemoizedNewIconWithText = React.memo<{ label: ReactNode }>(({ label }) => (
<FaPlusCircleIcon color="TEXT_LINK" text={<Text color="TEXT_LINK">「{label}」を追加</Text>} />
Copy link
Member Author

Choose a reason for hiding this comment

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

Icon自体はmemo化されていますが、textにReact.Componentが渡されれば毎回再レンダリングされてしまいます。
幸いlabelが切り替わる可能性がないため、Icon毎Textを含めた状態でmemo化するようにしました

))

const SelectButton = <T,>({
activeRef,
option,
Expand Down
Loading