react写一个从下往上划出的弹框弹窗组件

arco的弹窗还是不够丰富啊 , 还是自己造吧 。 看着垃圾 , 但可塑性强呀 ,拿去改改就能用 , 乱七八糟的ui组件库太多 ,轮子还是慢慢造吧

组件的样式使用的是tailwindcss ,有需要自查吧 ,但大概也是能够看出 ,什么css属性 , ,,写

import { useState, useEffect} from "react"

const SlideUpWindow = ({ children, isOpen, onClose }) => {
    const [isVisible, setIsVisible] = useState(false);

    useEffect(() => {
        setIsVisible(isOpen);
    }, [isOpen]);

    const handleClose = () => {
        setIsVisible(false);
        if (onClose) {
            onClose();
        }
    };

    return (
        <div
            style={{border:'1px solid red'}}
            className={`fixed bottom-0 right-0 w-[37%] transition-transform duration-300 h-[580px] ${isVisible ? 'translate-y-0  right-[3%] bottom-[4%]' : 'translate-y-full'
                }`}
        >
            <div className="flex justify-end">
                <button
                    onClick={handleClose}
                    className="p-2 text-white bg-gray-700 rounded-full focus:outline-none focus:bg-gray-800"
                >
                    <svg
                        xmlns="http://www.w3.org/2000/svg"
                        className="w-6 h-6"
                        fill="none"
                        viewBox="0 0 24 24"
                        stroke="currentColor"
                    >
                        <path
                            strokeLinecap="round"
                            strokeLinejoin="round"
                            strokeWidth={2}
                            d="M6 18L18 6M6 6l12 12"
                        />
                    </svg>
                </button>
            </div>
            <div className="bg-white rounded-t-lg shadow-lg">{children}</div>
        </div>
    );
};
export default SlideUpWindow;
相关推荐
叁分之一5 分钟前
“我打包又失败了”
前端·npm
tang游戏王1235 分钟前
AJAX进阶-day4
前端·javascript·ajax
无语听梧桐10 分钟前
vue3中使用Antv G6渲染树形结构并支持节点增删改
前端·vue.js·antv g6
如影随从11 分钟前
04-ArcGIS For JavaScript的可视域分析功能
开发语言·javascript·arcgis·可视域分析
Ratten29 分钟前
【taro react】(游戏) ---- 贪吃蛇
react.js
go2coding29 分钟前
开源 复刻GPT-4o - Moshi;自动定位和解决软件开发中的问题;ComfyUI中使用MimicMotion;自动生成React前端代码
前端·react.js·前端框架
freesharer1 小时前
Zabbix 配置WEB监控
前端·数据库·zabbix
web前端神器1 小时前
forever启动后端服务,自带日志如何查看与设置
前端·javascript·vue.js
才艺のblog1 小时前
127还是localhost....?
javascript·https·浏览器特性
是Yu欸1 小时前
【前端实现】在父组件中调用公共子组件:注意事项&逻辑示例 + 将后端数组数据格式转换为前端对象数组形式 + 增加和删除行
前端·vue.js·笔记·ui·vue