ui/sidebar: fix close animation

Animation needs static layout as a starting point
This commit is contained in:
Johannes Kirschbauer
2025-07-29 18:03:00 +02:00
parent b421698f70
commit 0f72f12461
2 changed files with 12 additions and 2 deletions

View File

@@ -3,6 +3,10 @@ div.sidebar-pane {
animation: sidebarPaneShow 250ms ease-in forwards;
&.open {
@apply w-60;
}
&.closing {
animation: sidebarPaneHide 250ms ease-out 300ms forwards;

View File

@@ -1,4 +1,4 @@
import { createSignal, JSX } from "solid-js";
import { createSignal, JSX, onMount } from "solid-js";
import "./SidebarPane.css";
import { Typography } from "@/src/components/Typography/Typography";
import Icon from "../Icon/Icon";
@@ -13,14 +13,20 @@ export interface SidebarPaneProps {
export const SidebarPane = (props: SidebarPaneProps) => {
const [closing, setClosing] = createSignal(false);
const [open, setOpened] = createSignal(true);
const onClose = () => {
setClosing(true);
setTimeout(() => props.onClose(), 550);
};
onMount(() => {
setTimeout(() => {
setOpened(true);
}, 250);
});
return (
<div class={cx("sidebar-pane", { closing: closing() })}>
<div class={cx("sidebar-pane", { closing: closing(), open: open() })}>
<div class="header">
<Typography hierarchy="body" size="s" weight="bold" inverted={true}>
{props.title}