Skip to content

Commit

Permalink
RadioControl: Fully encapsulate styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka committed Dec 22, 2023
1 parent ea21160 commit 77dc639
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/components/src/radio-control/index.tsx
Expand Up @@ -92,7 +92,10 @@ export function RadioControl(
}
{ ...additionalProps }
/>
<label htmlFor={ `${ id }-${ index }` }>
<label
className="components-radio-control__label"
htmlFor={ `${ id }-${ index }` }
>
{ option.label }
</label>
</div>
Expand Down
31 changes: 29 additions & 2 deletions packages/components/src/radio-control/style.scss
@@ -1,5 +1,32 @@
.components-radio-control__option {
display: flex;
align-items: center;
}

.components-radio-control__input[type="radio"] {
@include radio-control;
margin-top: 0;
margin-right: 6px;

display: inline-flex;
margin: 0 6px 0 0;
padding: 0;
appearance: none;
cursor: pointer;

&:focus {
box-shadow: 0 0 0 ($border-width * 2) $components-color-background, 0 0 0 ($border-width * 2 + $border-width-focus-fallback) $components-color-accent;
}

&:checked {
background: $components-color-accent;
border-color: $components-color-accent;

&::before {
content: "";
border-radius: 50%;
}
}
}

.components-radio-control__label {
cursor: pointer;
}

0 comments on commit 77dc639

Please sign in to comment.