Skip to content

[BOOKINGSG-9221][GZ] migrate radio button to linaria#1105

Open
ghazwan-gt wants to merge 14 commits intopre-release/v4from
BOOKINGSG-9221/radio-button
Open

[BOOKINGSG-9221][GZ] migrate radio button to linaria#1105
ghazwan-gt wants to merge 14 commits intopre-release/v4from
BOOKINGSG-9221/radio-button

Conversation

@ghazwan-gt
Copy link
Copy Markdown

Checklist

  • Migrated the component styles
    • className is chained correctly with clsx
    • User style prop is set as CSS variable
  • Changes follow the project guidelines in CONVENTIONS_V4.md
  • Updated Storybook documentation
  • Added/updated unit tests
  • Added visual tests
  • Listed breaking changes

radioUncheckedDisabled: Locator;
radioCheckedDisabled: Locator;

radioFocusableDisabled: Locator;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can be removed if not used

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Nice catch!

).toMatchAriaSnapshot(`
- radio [disabled] [checked]
`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should we add aria snapshot test for radioUncheckedDisabled to make it complete?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, we should

Comment thread src/radio-button/radio-button.styles.ts Outdated
Comment on lines +62 to +70
&.${classes.inputDisabledVisual} {
cursor: not-allowed;
}

&:not(.${classes.inputDisabledVisual}):hover + .${classes.icon} {
@media (pointer: fine) {
color: ${Colour["icon-hover"]};
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmm we could do this

const inputActive = css`
    &:hover + svg {
       // ...
    }
`

and only apply inputActive when !disabledVisual

Comment on lines +29 to +32
height: 100%;
width: 100%;
color: ${Colour["icon-subtle"]};
transition: ${Motion["duration-150"]} ${Motion["ease-default"]};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

height, width, transition could be a common icon class and uncheckedIcon and checkedIcon can define the colour

Comment thread src/radio-button/radio-button.styles.ts Outdated
color: ${Colour["icon-subtle"]};
transition: ${Motion["duration-150"]} ${Motion["ease-default"]};

&.${classes.iconDisabled} {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this could be a separate css tag


export default function Story() {
return (
<>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use the story-column-container here to add more spacing between the size variants

protected readonly component = "radio-button";

public readonly locators: {
components: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah I intended this to contain the common internal locators for components only. so this nesting of locators is not needed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Aah I see

Comment on lines +69 to +91
await expect(
story.getContainer(
story.locators.components.radioUncheckedDefault
)
).toMatchAriaSnapshot(`
- radio
`);

await expect(
story.getContainer(
story.locators.components.radioCheckedDefault
)
).toMatchAriaSnapshot(`
- radio [checked]
`);

await expect(
story.getContainer(
story.locators.components.radioCheckedDisabled
)
).toMatchAriaSnapshot(`
- radio [disabled] [checked]
`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can merge into a single snapshot and target story.layout

@qroll qroll added the type: chore For technical improvements or refactoring. label Apr 17, 2026
@qroll qroll added this to the v4.0.0-alpha.2 milestone Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: chore For technical improvements or refactoring.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants