Fix checkbox padding when table borders are enabled

This commit is contained in:
mrliptontea
2020-04-25 18:38:05 +01:00
parent 36000bd02c
commit 06e7e4fded
5 changed files with 60 additions and 2 deletions

View File

@@ -65,6 +65,8 @@ Latest (master):
* Changed tooltip background to black.
* Changed top menu styles.
* Restored `$color-priorities` variable, `false` by default.
* Added `parse-length($value, $side)` function for extracting length/width from margin/padding/border.
* Fixed checkbox cell padding when issue table borders are enabled.
v2.10.2 (2020-04-09):

4
src/sass/_functions.scss Normal file
View File

@@ -0,0 +1,4 @@
// Functions
// --------------------------------------------------
@import "functions/parse-length";

View File

@@ -1,4 +1,5 @@
@import "variables";
@import "functions";
@import "mixins";
@import "lib/normalize";

View File

@@ -86,8 +86,10 @@ table.list {
padding-right: $table-cell-padding;
padding-left: $table-cell-padding;
&:first-child {
padding-right: 0;
@if (parse-length($table-list-item-border, right) == 0) {
&:first-child {
padding-right: 0;
}
}
input {

View File

@@ -0,0 +1,49 @@
// Extract the length of margin/padding/border
// for given side from a shorthand syntax.
//
// Examples:
// parse-length(1px, top) -> 1px
// parse-length(1px 2px, right) -> 2px
// parse-length(1px 2px 3px 4px, bottom) -> 3px
// parse-length(1px 2px 3px 4px, left) -> 4px
//
@function parse-length($value, $side) {
$index: 1;
// Top values are always at index 1. The same for when the list has only one item
@if ($side == top or length($value) == 1) {
$index: 1;
}
// Covers "vertical horizontal" style
@else if (length($value) == 2) {
@if ($side == left or $side == right) {
$index: 2;
}
@if ($side == bottom) {
$index: 1;
}
}
// Covers "top horizontal bottom" style
@else if (length($value) == 3) {
@if ($side == left or $side == right) {
$index: 2;
}
@if ($side == bottom) {
$index: 3;
}
}
// Covers "top right bottom left" style
@else if (length($value) == 4) {
@if ($side == right) {
$index: 2;
}
@if ($side == bottom) {
$index: 3;
}
@if ($side == left) {
$index: 4;
}
}
@return nth($value, $index);
}