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

Radio: Add border to selected radio button #3808

11 changes: 7 additions & 4 deletions libs/designsystem/radio/src/radio.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@use '@kirbydesign/core/src/scss/utils';

$radio-icon-size: utils.size('m');
$radio-icon-mark-size: 60%;
$radio-icon-mark-size: 12px;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hardcoded the 12px since the 60% was no longer resulting in 12px size marker, caused from the newly added border which effectively reduced the size of the container from 20x20px to 18x18px.
Probably should be converted to rem when adding support for font-resize

$spacing-to-edge: map.get(utils.$checkbox-radio-spacing, 'to-edge');
$spacing-to-label: map.get(utils.$checkbox-radio-spacing, 'to-label');

Expand Down Expand Up @@ -101,7 +101,6 @@ ion-radio {
}
}
@include interaction-state.apply-active {
--color: transparent;
--color-checked: #{interaction-state.get-state-color('success')};

&::part(container) {
Expand Down Expand Up @@ -165,13 +164,17 @@ ion-radio {
}

&.radio-checked {
--border-width: 0px;

&:not(:focus, .radio-disabled) {
&::part(container) {
box-shadow: utils.get-elevation(4);
}
}

&:not(.radio-disabled) {
&::part(container) {
border-color: var(--kirby-semi-dark);
}
}
}
}

Expand Down
7 changes: 4 additions & 3 deletions libs/designsystem/radio/src/radio.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ describe('RadioComponent', () => {
it('should have correct icon styling', () => {
expect(radioIcon).toHaveComputedStyle({
'background-color': getColor('white'),
'border-width': '0px',
'border-width': '1px',
'border-color': getColor('semi-dark'),
'box-shadow': getElevation(4),
});
});
Expand Down Expand Up @@ -202,8 +203,8 @@ describe('RadioComponent', () => {
opacity: '1',
});
expect(radioIcon).toHaveComputedStyle({
'background-color': getColor('semi-light'),
'border-width': '0px',
'border-width': '1px',
'border-color': getColor('medium'),
'box-shadow': 'none',
});
});
Expand Down
Loading