Skip to content

Commit

Permalink
style(components): [col] fix gutter will be hidden when present (#16392)
Browse files Browse the repository at this point in the history
* [col] fix gutter will be hidden when present

* optimize code

* supplement
  • Loading branch information
Kataick committed Apr 16, 2024
1 parent e83a18e commit 9c2da88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
12 changes: 4 additions & 8 deletions packages/theme-chalk/src/col.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
}
}

.#{$namespace}-col-0 {
display: none;
// to avoid introducing !important syntax, redundant css rule is required due to selector priority.
@include when(guttered) {
display: none;
}
}

@for $i from 0 through 24 {
.#{$namespace}-col-#{$i} {
display: if($i == 0, none, block);
@include when(guttered) {
display: if($i == 0, none, block);
}
max-width: (math.div(1, 24) * $i * 100) * 1%;
flex: 0 0 (math.div(1, 24) * $i * 100) * 1%;
}
Expand Down
11 changes: 3 additions & 8 deletions packages/theme-chalk/src/mixins/_col.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@

@mixin col-size($size) {
@include res($size) {
.#{$namespace}-col-#{$size}-0 {
display: none;
@include when(guttered) {
display: none;
}
}
@for $i from 0 through 24 {
.#{$namespace}-col-#{$size}-#{$i} {
@if $i != 0 {
display: block;
display: if($i == 0, none, block);
@include when(guttered) {
display: if($i == 0, none, block);
}
max-width: (math.div(1, 24) * $i * 100) * 1%;
flex: 0 0 (math.div(1, 24) * $i * 100) * 1%;
Expand Down

0 comments on commit 9c2da88

Please sign in to comment.