Skip to content

Commit

Permalink
global.css re-added, radio button sizes added
Browse files Browse the repository at this point in the history
  • Loading branch information
verena-ifx authored and verena-ifx committed Jun 29, 2023
1 parent d9787a5 commit 4357099
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 22 deletions.
3 changes: 1 addition & 2 deletions examples/stencil-components/vanilla-cdn/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<script type="module" src="dist/infineon-design-system-stencil/infineon-design-system-stencil.esm.js"></script>
<link rel="stylesheet" href="dist/infineon-design-system-stencil/infineon-design-system-stencil.css">

<link rel="stylesheet" href="dist/infineon-design-system-stencil/infineon-design-system-stencil.css">

<title>Vanilla</title>
</head>
Expand Down Expand Up @@ -63,7 +62,7 @@ <h2>Text Input</h2>
<br />

<h2>Radio Button</h2>
<ifx-radio-button id="radio-btn" error="false" disabled="false" value="false">Text</ifx-radio-button>
<ifx-radio-button id="radio-btn" size="s" error="false" disabled="false" value="false">Text</ifx-radio-button>

</div>

Expand Down
1 change: 1 addition & 0 deletions packages/components-vue/lib/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ export const IfxRadioButton = /*@__PURE__*/ defineContainer<JSX.IfxRadioButton,
'disabled',
'value',
'error',
'size',
'ifxChange'
],
'value', 'ifxChange');
Expand Down
26 changes: 18 additions & 8 deletions packages/components/src/components/radio-button/radio-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@
padding: 0px;
gap: 8px;

&.s .radioButton__wrapper {
width: 20px;
height: 20px;
}

&.m .radioButton__wrapper {
width: 24px;
height: 24px;
}

& .radioButton__wrapper {
position: relative; // New
display: block; // Updated
position: relative;
display: block;
justify-content: center;
align-items: center;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: tokens.$color-bg-white;
border: 1px solid #575352;
Expand All @@ -25,10 +33,10 @@
padding: 0;

& .radioButton__wrapper-mark {
position: absolute; // New
top: 50%; // New
left: 50%; // New
transform: translate(-50%, -50%); // New
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #0A8276;
width: 8.75px;
height: 8.75px;
Expand Down Expand Up @@ -91,6 +99,8 @@
}

& .label {
display: flex;
align-items: center;
width: 25px;
height: 20px;
font-style: normal;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { action } from '@storybook/addon-actions';
import RadioButtonDocumentation from './radio-button_docs.mdx';


export default {
title: "Components/Radio Button",
parameters: {
Expand All @@ -14,14 +13,19 @@ export default {
error: false,
disabled: false,
value: false,
size: 's',
label: 'Text'
},
argTypes: { onIfxChange: { action: 'checked' } },

argTypes: {
onIfxChange: { action: 'checked' },
size: {
options: ['s', 'm'],
control: { type: 'radio' },
},

},
};


const DefaultTemplate = (args) => {
// Create the radio button element
const element = document.createElement('ifx-radio-button');
Expand All @@ -30,6 +34,7 @@ const DefaultTemplate = (args) => {
element.setAttribute('error', args.error);
element.setAttribute('disabled', args.disabled);
element.setAttribute('value', args.value);
element.setAttribute('size', args.size); // Added size prop

// Add the label as a text node
element.appendChild(document.createTextNode(args.label));
Expand All @@ -41,6 +46,4 @@ const DefaultTemplate = (args) => {
return element;
}


export const Default = DefaultTemplate.bind({});

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class RadioButton {
@Prop() disabled: boolean = false;
@Prop() value: boolean = false;
@Prop() error: boolean = false;
@Prop() size: "s" | "m" = "s"; // New size prop
@State() internalValue: boolean;
@State() hasSlot: boolean = true;

Expand Down Expand Up @@ -43,7 +44,7 @@ export class RadioButton {

render() {
return (
<div class="radioButton__container">
<div class={`radioButton__container ${this.size}`}>
<div
tabindex="0"
onClick={this.handleRadioButtonClick.bind(this)}
Expand Down
11 changes: 6 additions & 5 deletions packages/components/src/components/radio-button/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

## Properties

| Property | Attribute | Description | Type | Default |
| ---------- | ---------- | ----------- | --------- | ------- |
| `disabled` | `disabled` | | `boolean` | `false` |
| `error` | `error` | | `boolean` | `false` |
| `value` | `value` | | `boolean` | `false` |
| Property | Attribute | Description | Type | Default |
| ---------- | ---------- | ----------- | ------------ | ------- |
| `disabled` | `disabled` | | `boolean` | `false` |
| `error` | `error` | | `boolean` | `false` |
| `size` | `size` | | `"m" \| "s"` | `"s"` |
| `value` | `value` | | `boolean` | `false` |


## Events
Expand Down
1 change: 1 addition & 0 deletions packages/components/stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { frameworkTargets } from './framework-output-targets';

export const config: Config = {
namespace: 'infineon-design-system-stencil',
globalStyle: 'src/global/global.scss',
plugins: [
sass()
],
Expand Down

0 comments on commit 4357099

Please sign in to comment.