Skip to content

Commit

Permalink
Fixed Radio Button Checked
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham-Sharma-77 authored and surbhi90 committed Sep 28, 2021
1 parent 752b6b2 commit 30c0c22
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
5 changes: 3 additions & 2 deletions stories/Atom/Form/Checkbox/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
/* checkbox */
.checkbox-wrapper {
position: relative;
padding-left: 20px;
display: inline-block;
margin-right: $spacing-16;
padding-left: $spacing-24;
input[type=checkbox] {
top: 2px;
top: 5px;
left: 0;
opacity: 0;
z-index: 1;
Expand Down
14 changes: 10 additions & 4 deletions stories/Atom/Form/Radio/Radio.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ import './radio.scss';

export const Radio = ({ label }) => {
return (
<div className="radio-wrapper">
<input type="radio" id="edit-radio" className="custom-control-input"/>
<label id="checkmark" for="edit-radio" name="radioone" className="custom-control-label">{ label }</label>
</div>
<>
<div className="radio-wrapper">
<input type="radio" id="undp" name="fav_language" value="undp" className="custom-control-input"/>
<label for="undp" className="custom-control-label"><span className="radio_border"></span>{ label }</label>
</div>
<div className="radio-wrapper">
<input type="radio" id="undp2" name="fav_language" value="undp2" className="custom-control-input"/>
<label for="undp2" className="custom-control-label"><span className="radio_border"></span>{ label }</label>
</div>
</>
);
};
26 changes: 15 additions & 11 deletions stories/Atom/Form/Radio/radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,34 @@
/* radio */
.radio-wrapper {
position: relative;
padding-left: 20px;
display: inline-block;
margin-right: $spacing-16;
padding-left: $spacing-24;
input[type=radio] {
top: 2px;
left: 0;
opacity: 0;
position: absolute;
& + label {
cursor: pointer;
&:hover::before {
border-color: $color-light-pink;
}
&::before {
@extend %checbox-radio-before;
.radio_border {
border-radius: 50%;
@extend %checbox-radio-before;
}
&:hover .radio_border {
border-color: $color-light-pink;
}
}
&:checked + label::after {
top: -3px;
&:checked + label .radio_border::after {
top: 50%;
left: 3px;
content: "";
color: $color-dark-red;
font-size: 19px;
content: "";
width: 6px;
height: 6px;
position: absolute;
background: $color-dark-red;
border-radius: 50%;
transform: translateY(-50%);
}
}
}
4 changes: 2 additions & 2 deletions stories/assets/scss/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@
}
}

%checbox-radio-before{
%checbox-radio-before {
left: 0;
top: 2px;
top: 5px;
content: "";
width: 12px;
height: 12px;
Expand Down

0 comments on commit 30c0c22

Please sign in to comment.