Skip to content

Commit

Permalink
Update css
Browse files Browse the repository at this point in the history
  • Loading branch information
ElishaSamPeterPrabhu committed Dec 11, 2023
1 parent 914bae4 commit cbec7c3
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -900,14 +900,14 @@ export declare interface ModusProgressBar extends Components.ModusProgressBar {}


@ProxyCmp({
inputs: ['ariaLabel', 'checkedId', 'name', 'radioButtons']
inputs: ['ariaLabel', 'checkedId', 'name', 'radioButtons', 'size']
})
@Component({
selector: 'modus-radio-group',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: ['ariaLabel', 'checkedId', 'name', 'radioButtons'],
inputs: ['ariaLabel', 'checkedId', 'name', 'radioButtons', 'size'],
})
export class ModusRadioGroup {
protected el: HTMLElement;
Expand Down
8 changes: 8 additions & 0 deletions stencil-workspace/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,10 @@ export namespace Components {
* The radio buttons to render.
*/
"radioButtons": RadioButton[];
/**
* (optional) The size of the radiobutton.
*/
"size"?: 'small' | 'medium';
}
interface ModusSelect {
/**
Expand Down Expand Up @@ -2900,6 +2904,10 @@ declare namespace LocalJSX {
* The radio buttons to render.
*/
"radioButtons"?: RadioButton[];
/**
* (optional) The size of the radiobutton.
*/
"size"?: 'small' | 'medium';
}
interface ModusSelect {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ div.modus-radio-group {

.checkmark {
background-color: $modus-radio-btn-bg;
border: $rem-2px solid $modus-radio-btn-border-color;
border: $rem-3px solid $modus-radio-btn-border-color;
border-radius: 50%;
height: $rem-14px;
position: absolute;
Expand All @@ -39,14 +39,19 @@ div.modus-radio-group {
.checkmark {
height: $rem-10px;
width: $rem-10px;
border: $rem-2px solid $modus-radio-btn-border-color;
}

input:checked ~ .checkmark::after {
height: 0.405rem; // Specific size so that the check is centered.
left: $rem-2px;
top: $rem-2px;
left: 0.125rem;
top: 0.1rem;
width: 0.405rem;
}
&:focus .checkmark {
outline: $rem-2px solid $modus-radio-btn-focus-box-shadow-color;
outline-offset: $rem-2px;
}

label {
font-size: $rem-10px;
Expand All @@ -59,11 +64,11 @@ div.modus-radio-group {
border-radius: 50%;
content: '';
display: none;
height: 0.5125rem; // Specific size so that the check is centered.
left: $rem-3px;
height: 0.6125rem; // Specific size so that the check is centered.
left: $rem-2px;
position: absolute;
top: $rem-3px;
width: 0.5125rem;
top: $rem-2px;
width: 0.6125rem;
}

input:checked ~ .checkmark {
Expand Down Expand Up @@ -92,8 +97,8 @@ div.modus-radio-group {

&:focus .checkmark {
border-color: $modus-radio-btn-hover-border-color;
outline: $rem-2px solid $modus-radio-btn-focus-box-shadow-color;
outline-offset: $rem-2px;
outline: $rem-3px solid $modus-radio-btn-focus-box-shadow-color;
outline-offset: $rem-3px;
}
}

Expand Down
22 changes: 22 additions & 0 deletions stencil-workspace/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,27 @@

<body>
<!-- Test components -->
<div>
<modus-radio-group checked-id="1" size="small" name="my-group"></modus-radio-group>
<modus-radio-group checked-id="1" size="default" name="my-group2"></modus-radio-group>
<script>
const modusRadioGroup = document.querySelector('modus-radio-group');
modusRadioGroup.radioButtons = [
{
id: '0',
label: 'Radio 2',
},
{
id: '1',
checked: true,
label: 'Radio 2',
},
{
id: '2',
label: 'Radio 3',
},
];
</script>
</div>
</body>
</html>

0 comments on commit cbec7c3

Please sign in to comment.