import { View } from "@tarojs/components";
import Taro, { useMemo, useState } from "@tarojs/taro";
import { classNames } from "../../lib";
import { IProps } from "../../../@types/drawer";
export default function ClDrawer(props: IProps) {
const [showModal, setShowModal] = useState(props.show);
useMemo(() => {
setShowModal(props.show);
}, [props.show]);
const hideModal = () => {
props.closeWithShadow && setShowModal(false);
props.onCancel && props.onCancel();
};
const leftComponent = (
{
hideModal();
e.stopPropagation();
}}
>
{
e.stopPropagation();
}}
style={{ height: "100vh" }}
>
{this.props.children}
);
const rightComponent = (
{
hideModal();
e.stopPropagation();
}}
>
{
e.stopPropagation();
}}
style={{ height: "100vh" }}
>
{this.props.children}
);
const bottomComponent = (
{
hideModal();
e.stopPropagation();
}}
>
{
e.stopPropagation();
}}
>
{this.props.children}
);
return props.direction === "left"
? leftComponent
: props.direction === "right"
? rightComponent
: bottomComponent;
}
ClDrawer.options = {
addGlobalClass: true
};