Skip to content

Commit

Permalink
Merge pull request #492 from Infineon/287-design-review-component-rad…
Browse files Browse the repository at this point in the history
…io-button

radio-button design review updates
  • Loading branch information
tishoyanchev authored Sep 11, 2023
2 parents 21ec1cb + 63ef51d commit 7b4ea88
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ describe('ifx-radio-button', () => {



it('renders changes to the error prop', async () => {
const page = await newE2EPage();
await page.setContent('<ifx-radio-button>Error Test</ifx-radio-button>');
const component = await page.find('ifx-radio-button');

component.setProperty('error', true);
await page.waitForChanges();
const element = await page.find('ifx-radio-button >>> .label');
expect(element).toHaveClass('error');
});



it('handleRadioButtonClick should emit ifxChange event if not disabled and not in error', async () => {
Expand Down
18 changes: 11 additions & 7 deletions packages/components/src/components/radio-button/radio-button.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use "~@infineon/design-system-tokens/dist/tokens";
@use "../../global/font.scss";

.radioButton__container {
box-sizing: border-box;
Expand Down Expand Up @@ -53,7 +54,7 @@
}

&:hover {
border-color: #0A8276;
background-color: tokens.$ifxColorEngineering200;
}

&.disabled {
Expand Down Expand Up @@ -90,10 +91,10 @@


&:hover {
border-color: #08665C;
border-color: tokens.$ifxColorOcean600;

& .radioButton__wrapper-mark {
background-color: #08665C;
background-color: tokens.$ifxColorOcean600;
}
}

Expand Down Expand Up @@ -124,7 +125,6 @@
.label {
display: flex;
align-items: center;
width: 25px;
height: tokens.$ifxSize250;
font-style: normal;
font-weight: 400;
Expand All @@ -135,13 +135,17 @@
order: 1;
flex-grow: 0;

&.label-m {
height: tokens.$ifxSize300;
font-size: tokens.$ifxFontSizeM;
line-height: tokens.$ifxLineHeightM;
}

&.disabled {
color: #BFBBBB;
}

&.error {
color: #CD002F;
}


&:hover {
cursor: pointer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class RadioButton {


handleRadioButtonClick() {
if (!this.disabled) {
if (!this.disabled && !this.error) {
this.internalValue = !this.internalValue;
this.el.shadowRoot.querySelector('.radioButton__wrapper').focus();
this.ifxChange.emit(this.internalValue);
Expand All @@ -48,13 +48,16 @@ export class RadioButton {
onClick={this.handleRadioButtonClick.bind(this)}
>
<div
class={`radioButton__wrapper ${this.internalValue ? 'checked' : ''} ${this.disabled ? 'disabled' : ''} ${this.error ? 'error' : ''}`}
class={`radioButton__wrapper
${this.internalValue ? 'checked' : ''}
${this.disabled ? 'disabled' : ''}
${this.error ? 'error' : ''}`}
tabIndex={this.disabled ? -1 : 0}
>
{this.internalValue && <div class="radioButton__wrapper-mark"></div>}
</div>
{this.hasSlot && (
<div class={`label ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}`}>
<div class={`label ${this.size === "m" ? "label-m" : ""} ${this.disabled ? 'disabled' : ''}`}>
<slot />
</div>
)}
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

<body>


</body>

</html>

0 comments on commit 7b4ea88

Please sign in to comment.