feat: add height transitions for detail content and code block content (#628)

- [interpolate-size](https://developer.mozilla.org/en-US/docs/Web/CSS/interpolate-size)
- [calc-size()](https://developer.mozilla.org/en-US/docs/Web/CSS/calc-size)
This commit is contained in:
Cell
2025-08-24 16:08:06 +08:00
committed by GitHub
parent c174646bb2
commit e9366b5ab2
6 changed files with 16 additions and 24 deletions
+8
View File
@@ -63,6 +63,14 @@ img,video {
height: auto;
}
details {
&.center {
summary {
text-align: center;
}
}
}
%code {
padding: 0.2em 0.4em;
margin: 0;
+2
View File
@@ -27,6 +27,8 @@
#{$rootPrefix}scrollbar-track-color: transparent;
#{$rootPrefix}scrollbar-width: thin;
#{$rootPrefix}scrollbar-width-legacy: 12px;
interpolate-size: allow-keywords;
}
// Dark theme
-15
View File
@@ -1,15 +0,0 @@
@mixin details-transition-open {
@include transition(max-height 0.2s cubic-bezier(0, 1, 0, 1) -0.1s);
}
@mixin details-transition-close {
@include transition(max-height 0.2s cubic-bezier(0.5, 0, 1, 0) 0s);
}
details {
&.center {
summary {
text-align: center;
}
}
}
-1
View File
@@ -1,6 +1,5 @@
@import '_compatibility';
@import '_link';
@import '_blur';
@import '_details';
@import '_scrollbar-width';
@import '_z-index';
+3 -4
View File
@@ -17,9 +17,9 @@
}
> .details-content {
max-height: 0;
height: 0;
overflow-y: hidden;
@include details-transition-open;
@include transition(height 0.5s ease-out);
}
&.open {
@@ -32,9 +32,8 @@
}
> .details-content {
max-height: 100%;
height: auto;
@include border-radius(0 0 $global-border-radius $global-border-radius);
@include details-transition-close;
}
}
+3 -4
View File
@@ -82,9 +82,9 @@ pre:not([data-processed]) {
// delayed loading table-wrapper
& + .table-wrapper {
max-height: 0;
height: 0;
@include border-radius(0 0 $global-border-radius $global-border-radius);
@include details-transition-open;
@include transition(height 0.5s ease-out);
}
[data-theme='dark'] & {
@@ -227,8 +227,7 @@ pre:not([data-processed]) {
}
.table-wrapper {
max-height: 100%;
@include details-transition-close;
height: auto;
}
.arrow {