ui/sidebar: fix close animation
Animation needs static layout as a starting point
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user