Skip to content

Commit

Permalink
feat: add details animation styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Zuniga Cuellar committed Dec 24, 2024
1 parent 29cdb81 commit b21e43a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/starlight/components/Page.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { Props } from '../props';
import '../style/props.css';
import '../style/reset.css';
import '../style/shiki.css';
import '../style/details.css';
import '../style/util.css';
// Components — can override built-in CSS, but not user CSS.
Expand Down
25 changes: 25 additions & 0 deletions packages/starlight/style/details.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
details {
interpolate-size: allow-keywords;
}

details::details-content {
block-size: 0;
opacity: 0;
transform: translateY(-5px);
}

details[open]::details-content {
block-size: auto;
opacity: 1;
transform: translateY(0px);
}

@media (prefers-reduced-motion: no-preference) {
details::details-content {
transition:
block-size 200ms ease-in-out,
content-visibility 200ms allow-discrete ease-in-out,
opacity 200ms ease-in-out,
transform 200ms ease-in-out;
}
}

0 comments on commit b21e43a

Please sign in to comment.