Merge pull request 'ui/sidebar: fix close animation' (#4524) from sidebar-fix into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4524
This commit is contained in:
@@ -3,6 +3,10 @@ div.sidebar-pane {
|
|||||||
|
|
||||||
animation: sidebarPaneShow 250ms ease-in forwards;
|
animation: sidebarPaneShow 250ms ease-in forwards;
|
||||||
|
|
||||||
|
&.open {
|
||||||
|
@apply w-60;
|
||||||
|
}
|
||||||
|
|
||||||
&.closing {
|
&.closing {
|
||||||
animation: sidebarPaneHide 250ms ease-out 300ms forwards;
|
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 "./SidebarPane.css";
|
||||||
import { Typography } from "@/src/components/Typography/Typography";
|
import { Typography } from "@/src/components/Typography/Typography";
|
||||||
import Icon from "../Icon/Icon";
|
import Icon from "../Icon/Icon";
|
||||||
@@ -13,14 +13,20 @@ export interface SidebarPaneProps {
|
|||||||
|
|
||||||
export const SidebarPane = (props: SidebarPaneProps) => {
|
export const SidebarPane = (props: SidebarPaneProps) => {
|
||||||
const [closing, setClosing] = createSignal(false);
|
const [closing, setClosing] = createSignal(false);
|
||||||
|
const [open, setOpened] = createSignal(true);
|
||||||
|
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
setClosing(true);
|
setClosing(true);
|
||||||
setTimeout(() => props.onClose(), 550);
|
setTimeout(() => props.onClose(), 550);
|
||||||
};
|
};
|
||||||
|
onMount(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
setOpened(true);
|
||||||
|
}, 250);
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={cx("sidebar-pane", { closing: closing() })}>
|
<div class={cx("sidebar-pane", { closing: closing(), open: open() })}>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<Typography hierarchy="body" size="s" weight="bold" inverted={true}>
|
<Typography hierarchy="body" size="s" weight="bold" inverted={true}>
|
||||||
{props.title}
|
{props.title}
|
||||||
|
|||||||
Reference in New Issue
Block a user