update line-clamp class

add `line-clamp-sm-[1-6]` for use with elements that have lh-sm applied
calculate max-height from line-height instead of hardcoding to 1.25em
isekai-main
Barış Soner Uşaklı 2 years ago
parent 1b862586d1
commit fa633ec7ca

@ -89,18 +89,22 @@
font-size: $font-size;
}
@mixin line-clamp($lines) {
@mixin line-clamp($lines, $line-height: 1.5em) {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: $lines;
white-space: initial;
max-height: calc(1.25em * $lines);
max-height: calc($line-height * $lines);
}
@for $i from 1 through 6 {
.line-clamp-#{$i} {
@include line-clamp($i);
@include line-clamp($i, #{$line-height-base}em);
}
// use with elements that have `lh-sm` applied
.line-clamp-sm-#{$i} {
@include line-clamp($i, #{$line-height-sm}em);
}
}

Loading…
Cancel
Save