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

fix: Fix l'alignement des radios et checkboxes #3309

Merged
merged 4 commits into from
Sep 30, 2024
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
15 changes: 9 additions & 6 deletions src/client/components/ui/Checkbox/Checkbox.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
@use "@styles/utilities";
@use "@styles/components/form/variables";

$checkbox-width: 1rem;
$checkbox-padding: .5rem;

%checkbox {
content: "";
width: 1rem;
height: 1rem;
width: $checkbox-width;
aspect-ratio: 1;
background-size: 1rem;
background-position: center;
background-repeat: no-repeat;
Expand Down Expand Up @@ -42,7 +45,7 @@

input[type=checkbox] + label {
position: relative;
padding: 0.75rem 0 .75rem 2rem;
padding: 0.75rem 0 0.75rem calc($checkbox-width + 2 * $checkbox-padding);
-webkit-tap-highlight-color: transparent;
display: flex;
flex-direction: row;
Expand All @@ -55,9 +58,9 @@
@extend %checkbox;
display: block;
position: absolute;
top: 0;
left: 0.5rem;
margin-top: 1rem;
top: 50%;
transform: translateY(-50%);
left: $checkbox-padding;
}

input[type=checkbox]:checked + label::before {
Expand Down
16 changes: 10 additions & 6 deletions src/client/components/ui/Radio/Radio.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
@use "@styles/utilities";
@use "@styles/components/form/variables";

$radio-width: 1rem;
$radio-padding: .5rem;

%radio {
content: "";
width: 1rem;
height: 1rem;
width: $radio-width;
aspect-ratio: 1;
border-radius: 50%;
box-shadow: inset 0 0 0 1px utilities-deprecated.$color-on-surface;
}
Expand Down Expand Up @@ -38,7 +41,8 @@

input[type=radio] + label {
position: relative;
padding: 0.75rem 0 .75rem 2rem;
// FIXME (GAFI 06-09-2024): Probablement moyen de faire beaucoup mieux avec du grid
padding: 0.75rem 0 0.75rem calc($radio-width + 2 * $radio-padding);
-webkit-tap-highlight-color: transparent;
display: flex;
flex-direction: row;
Expand All @@ -50,9 +54,9 @@
input[type=radio] + label::before {
display: block;
position: absolute;
top: 0;
left: 0.5rem;
margin-top: 1rem;
top: 50%;
transform: translateY(-50%);
left: $radio-padding;
@extend %radio
}

Expand Down