Skip to content

Commit

Permalink
[form-cb-rb-semantic-v2] Fix styles (Radio)
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Andrade committed Jan 28, 2025
1 parent 8a92bc0 commit 2c13554
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const _generateStyles = (checked: Checked, error: boolean) => {

// The different states that the component can be in.
const states = {
// Resting state
// Resting state (shared between checked and unchecked)
default: {
border: colorAction.default.border,
background: colorAction.default.background,
Expand Down
14 changes: 9 additions & 5 deletions packages/wonder-blocks-form/src/components/radio-core.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ const _generateStyles = (checked: Checked, error: boolean) => {

// The different states that the component can be in.
const states = {
// Resting state
default: {
// Resting state (unchecked)
unchecked: {
border: semanticColor.border.strong,
background: colorAction.default.background,
},
checked: {
// NOTE: This is a special case where the border is the same color
// as the foreground. This should change as soon as we simplify the
// existing `action` tokens.
Expand All @@ -128,8 +132,8 @@ const _generateStyles = (checked: Checked, error: boolean) => {
if (checked) {
newStyles = {
default: {
backgroundColor: states.default.background,
borderColor: states.default.border,
backgroundColor: states.checked.background,
borderColor: states.checked.border,
borderWidth: size / 4,

// Focus and hover have the same style. Focus style only shows
Expand All @@ -153,7 +157,7 @@ const _generateStyles = (checked: Checked, error: boolean) => {
},
};
} else {
const currentState = error ? states.error : states.default;
const currentState = error ? states.error : states.unchecked;

newStyles = {
default: {
Expand Down

0 comments on commit 2c13554

Please sign in to comment.