Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Radio Button Checked #43

Merged
merged 1 commit into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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