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: PageCounterの内部処理をリファクタリングする #5276

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

Conversation

AtsushiM
Copy link
Member

関連URL

概要

変更内容

確認方法

Copy link

pkg-pr-new bot commented Jan 14, 2025

Open in Stackblitz

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

commit: 3262727

@@ -25,40 +25,51 @@ const pageCounter = tv({ base: 'shr-text-base' })
export const PageCounter: React.FC<Props & ElementProps> = ({
start,
end,
total = 0,
total,
Copy link
Member Author

Choose a reason for hiding this comment

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

初期化位置をtotalを表示するmemo化済みコンポーネントに移動しています

Comment on lines +34 to +39
if (!decorators) {
return {
text: () => RANGE_SEPARATOR,
visuallyHiddenText: () => RANGE_SEPARATOR_VISUALLY_HIDDEN_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.

decoratorsの子要素分判定する無駄を省くため、先にdecorators自体のチェックを行うようにしています

<span>/</span>
<BoldNumber>{children}</BoldNumber>
</>
),
Copy link
Member Author

Choose a reason for hiding this comment

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

Totalに関してはレンダリングされる可能性が低いため、memo化しています

@AtsushiM AtsushiM marked this pull request as ready for review January 14, 2025 23:10
@AtsushiM AtsushiM requested a review from a team as a code owner January 14, 2025 23:10
@AtsushiM AtsushiM requested review from yuzuru-akiyama and uknmr and removed request for a team January 14, 2025 23:10
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