-
Notifications
You must be signed in to change notification settings - Fork 141
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: テキスト系のシンプルなコンポーネントをmemo化する #5406
base: master
Are you sure you want to change the base?
Conversation
bcbc89a
to
254cc97
Compare
254cc97
to
8ef3027
Compare
commit: |
} | ||
|
||
export const Text = memo(ActualText) as typeof ActualText |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genericsを使ったコンポーネントをmemo化する場合、asで明確に型付けし直すことで問題なく設定できます。
https://www.google.com/search?q=typescript+generics+memo&oq=typescript+generics+memo&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIHCAEQABjvBTIHCAIQABjvBTIHCAMQABjvBTIHCAQQABjvBTIHCAUQABjvBdIBCDkyMjhqMGo3qAIAsAIA&sourceid=chrome&ie=UTF-8
|
||
return ( | ||
<div className={style}> | ||
<TextLink {...rest} elementAs={elementAs} prefix={<FaArrowLeftIcon />} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elementAsが消えているように見えますが、https://github.com/kufu/smarthr-ui/pull/5406/files#diff-5f096a050e1946adb3b1a45c9737159ebceea44f39788f072ea5b19eee4385baR23 でrestに含めるようにしているため、指定としては同じ状態になっています
import { tv } from 'tailwind-variants' | ||
|
||
export const visuallyHiddenText = tv({ | ||
export const visuallyHiddenTextClassNameGenerator = tv({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visuallyHiddenText
ではコンポーネントと区別がつきにくいため、明確にしました。
長くてちょっと...とも思いますが基本的にsmarthr-ui内に隠蔽される概念のため、空目・typoよりはマシかと...
…memoized-simple-component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
関連URL
概要
変更内容
確認方法