Skip to content

[PANGOO-2905][BpkCheckbox]Checkbox With SVG #3774

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

Merged
merged 17 commits into from
Mar 27, 2025
Merged
34 changes: 8 additions & 26 deletions packages/bpk-mixins/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -627,34 +627,16 @@
/// @include bpk-checkbox__checkmark();
/// }
@mixin bpk-checkbox__checkmark {
&::before,
&::after {
position: absolute;
content: '';
transform: rotate(45deg);
border-radius: $bpk-border-size-lg;
background-color: $bpk-text-primary-inverse-day;
}

&::before {
top: bpk-spacing-md() - $bpk-one-pixel-rem;
left: 0;
width: bpk-spacing-lg() / 3;
height: bpk-spacing-sm() - $bpk-one-pixel-rem;
}

&::after {
top: bpk-spacing-sm() / 2;
left: bpk-spacing-md() - $bpk-one-pixel-rem;
width: bpk-spacing-sm() - $bpk-one-pixel-rem;
height: bpk-spacing-md() + ($bpk-one-pixel-rem * 3);
}
background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22white%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E');
background-repeat: no-repeat;
background-position: $bpk-one-pixel-rem * 0.5 center;
background-size: calc(100% - $bpk-one-pixel-rem * 2.5) auto;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, how do we get 0.5 and 2.5 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's only a subjective number to make the visual effect look good. The problem is that the left padding and the right padding of the svg I get are slightly different, it is not good looking without this adjustment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note here: the design has confirmed with the backpack designer by @senzg


&:disabled {
&::before,
&::after {
background-color: $bpk-text-disabled-day;
}
background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22lightgrey%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E');
background-repeat: no-repeat;
background-position: $bpk-one-pixel-rem * 0.5 center;
background-size: calc(100% - $bpk-one-pixel-rem * 2.5) auto;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to declare background-repeat background-position background-size again? seems we already declare them in L631-L633

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, thanks for your reminding! They are deleted and tested

}
}

Expand Down
Loading