Commit d78a13e2 authored by chenshouchao's avatar chenshouchao

UI: 动画样式优化

parent e72d8822
...@@ -8,13 +8,10 @@ ...@@ -8,13 +8,10 @@
z-index: 100; z-index: 100;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center;
animation: showBG 0.31s ease; animation: showBG 0.31s ease;
-webkit-animation: showBG 0.31s ease; -webkit-animation: showBG 0.31s ease;
} }
.drawerBoxHidden {
animation: hiddenBG 0.31s ease;
-webkit-animation: hiddenBG 0.31s ease;
}
.closeBox { .closeBox {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
...@@ -23,13 +20,6 @@ ...@@ -23,13 +20,6 @@
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
align-items: center;
animation: showClose 0.31s ease;
-webkit-animation: showClose 0.31s ease;
}
.closeBoxHidden {
animation: hiddenClose 0.31s ease;
-webkit-animation: hiddenClose 0.31s ease;
} }
.closeiIcon { .closeiIcon {
position: absolute; position: absolute;
...@@ -44,17 +34,14 @@ ...@@ -44,17 +34,14 @@
position: fixed; position: fixed;
top: 40px; top: 40px;
left: 0; left: 0;
right: 0;
background-color: #fff; background-color: #fff;
border-radius: 16px 0 0 0; border-radius: 16px 0 0 0;
/* padding: 24px 32px; */
box-sizing: border-box; box-sizing: border-box;
overflow: scroll; overflow: scroll;
animation: showDrawer 0.31s ease; animation: showDrawer 0.31s ease;
-webkit-animation: showDrawer 0.31s ease; -webkit-animation: showDrawer 0.31s ease;
} margin: 0 auto;
.contentBoxHidden {
animation: hiddenDrawer 0.31s ease;
-webkit-animation: hiddenDrawer 0.31s ease;
} }
@keyframes showBG { @keyframes showBG {
...@@ -66,47 +53,15 @@ ...@@ -66,47 +53,15 @@
} }
} }
@keyframes hiddenBG {
from {
background-color: rgba(0, 0, 0, 0.78);
}
to {
background-color: rgba(0, 0, 0, 0);
}
}
@keyframes showClose {
from {
top: calc(100% - 40px);
}
to {
top: 0px;
}
}
@keyframes hiddenClose {
from {
top: 0px;
}
to {
top: calc(100% - 40px);
}
}
@keyframes showDrawer { @keyframes showDrawer {
from { from {
top: 100%; top: 160px;
width: calc(100vw - 28px);
opacity: 0;
} }
to { to {
top: 40px; top: 40px;
} width: 100vw;
} opacity: 1;
@keyframes hiddenDrawer {
from {
top: 40px;
}
to {
top: 100%;
} }
} }
// 从下往上弹的全屏抽屉 // 从下往上弹的全屏抽屉
import { useState } from "react"; // import { useState } from "react";
import style from "./index.module.css"; import style from "./index.module.css";
import classNames from "classnames"; import classNames from "classnames";
import CloseOutlinedIcon from "@mui/icons-material/CloseOutlined"; import CloseOutlinedIcon from "@mui/icons-material/CloseOutlined";
...@@ -11,26 +11,26 @@ type IFullScreenDrawerProps = { ...@@ -11,26 +11,26 @@ type IFullScreenDrawerProps = {
const FullScreenDrawer = (props: IFullScreenDrawerProps) => { const FullScreenDrawer = (props: IFullScreenDrawerProps) => {
const { children, handleClose } = props; const { children, handleClose } = props;
const [closeing, setCloseing] = useState(false); // const [closeing, setCloseing] = useState(false);
const handleReadyToClose = () => { const handleReadyToClose = () => {
setCloseing(true); // setCloseing(true);
setTimeout(() => { // setCloseing(false);
setCloseing(false); handleClose();
handleClose(); // setTimeout(() => {
}, 300); // }, 300);
}; };
return ( return (
<div <div
className={classNames({ className={classNames({
[style.drawerBox]: true, [style.drawerBox]: true,
[style.drawerBoxHidden]: closeing, // [style.drawerBoxHidden]: closeing,
})} })}
> >
<div <div
className={classNames({ className={classNames({
[style.closeBox]: true, [style.closeBox]: true,
[style.closeBoxHidden]: closeing, // [style.closeBoxHidden]: closeing,
})} })}
> >
<CloseOutlinedIcon <CloseOutlinedIcon
...@@ -41,7 +41,7 @@ const FullScreenDrawer = (props: IFullScreenDrawerProps) => { ...@@ -41,7 +41,7 @@ const FullScreenDrawer = (props: IFullScreenDrawerProps) => {
<div <div
className={classNames({ className={classNames({
[style.contentBox]: true, [style.contentBox]: true,
[style.contentBoxHidden]: closeing, // [style.contentBoxHidden]: closeing,
})} })}
> >
{children} {children}
......
...@@ -53,7 +53,7 @@ const SeeDataset = observer((props: ISeeDatasetProps) => { ...@@ -53,7 +53,7 @@ const SeeDataset = observer((props: ISeeDatasetProps) => {
useEffect(() => { useEffect(() => {
setTimeout(() => { setTimeout(() => {
setShowAnimation(false); setShowAnimation(false);
}, 1000); }, 300);
}, []); }, []);
const isCadd = useMemo(() => { const isCadd = useMemo(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment