-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat(react): update radio v4 #522
Conversation
Size Change: -9.33 kB (-0.3%) Total Size: 3.12 MB
ℹ️ View Unchanged
|
Visit the preview URL for this PR (updated for commit a4414d6): https://pixiv-charcoal-web--pr522-naporitan-add-radio-96nmpl80.web.app (expires Wed, 29 May 2024 05:34:43 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 314b26d3adca98a761c7e4d9922ebb206ff024a0 |
372c6a5
to
be0023c
Compare
This reverts commit be0023c.
@@ -23,6 +24,8 @@ const Radio = forwardRef<HTMLInputElement, RadioProps>(function RadioInner( | |||
onChange, | |||
} = useContext(RadioGroupContext) | |||
|
|||
const className = useClassNames('charcoal-radio', props.className) |
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.
I think it's better to use names that include DOM tags.
charcoal-radio
=>charcoal-radio__label
charcoal-radio__label
=>charcoal-radio__label_div
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.
ok thank you review.
.charcoal-radio__label::before { | ||
display: block; | ||
width: 0; | ||
height: 0; | ||
content: ''; | ||
margin-top: -4px; | ||
} | ||
.charcoal-radio__label::after { | ||
display: block; | ||
width: 0; | ||
height: 0; | ||
content: ''; | ||
margin-bottom: -4px; | ||
} |
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.
We can remove these styles. The new style doesn't use any hacked adjustments.
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.
Oh. Ok!
'll fix the other PRs.
.charcoal-radio__label { | ||
font-size: 14px; | ||
line-height: 22px; | ||
display: flow-root; |
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.
We can remove display: flow-root;
@@ -211,43 +99,46 @@ const RadioGroupContext = React.createContext<RadioGroupContext>({ | |||
}) | |||
|
|||
export function RadioGroup<Value extends string = string>({ |
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.
This might be a good opportunity to switch to forwardRef
. In addition, make sure to pass the rest props to the div.
@@ -11,7 +12,7 @@ export type RadioProps = React.PropsWithChildren<{ | |||
}> | |||
|
|||
const Radio = forwardRef<HTMLInputElement, RadioProps>(function RadioInner( | |||
{ value, disabled = false, children, className }, | |||
{ value, disabled = false, children, ...props }, |
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.
There is the same issue here.
https://github.com/pixiv/charcoal/pull/523/files#r1602999626
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.
fixed
やったこと
動作確認環境
チェックリスト
不要なチェック項目は消して構いません
備考
@react-aria/radio
があるがそちらを使ったほうが良いか?