Add Partials (#1824)

This commit is contained in:
Marvin Hagemeister
2023-09-27 13:34:30 +02:00
committed by GitHub
parent d9829e25e6
commit 665d35bbc2
92 changed files with 3271 additions and 116 deletions
+26
View File
@@ -0,0 +1,26 @@
import { useEffect, useRef } from "preact/hooks";
import { ComponentChildren } from "preact";
export function Fader(props: { children?: ComponentChildren }) {
const ref = useRef<HTMLDivElement>(null);
const mounted = useRef(false);
useEffect(() => {
if (!mounted.current) {
mounted.current = true;
return;
}
if (ref.current) {
ref.current.animate([
{ backgroundColor: "white" },
{ backgroundColor: "peachpuff" },
], {
fill: "backwards",
easing: "ease-out",
duration: 600,
});
}
});
return <div ref={ref}>{props.children}</div>;
}