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;
相关推荐
usdoc文档预览3 分钟前
国产化踩坑:Vue3 / React / 小程序如何免插件实现 OFD 及复杂 Office 文档同屏预览
前端·javascript·react.js·小程序·pdf·word·office文件在线预览
坏小虎6 分钟前
【聊天列表组件选型建议】FlashList、FlatList、LegendList三种列表组件
javascript·react native·react.js
UXbot10 分钟前
评审前2小时完成页面布局:前端AI工具快速出图工作流
前端·人工智能·交互·产品经理·web app·ui设计
懂懂tty19 分钟前
Vue3 手写响应式原理
前端·vue.js
鹏程十八少20 分钟前
Android 无障碍服务失效,一次AccessibilityService“离奇死亡”的完整破案实录
前端·后端·面试
weixin_5118753327 分钟前
【无标题】
前端
木斯佳44 分钟前
前端八股文面经大全:质谱华章前端一面(2026-05-14)·面经深度解析
前端·面试·面经
水煮白菜王1 小时前
JSONEditor 使用指南
前端·javascript·chrome·json
2401_865439631 小时前
探索JavaScript对象创建的灵活方式
开发语言·javascript·ecmascript
GISer_Jing1 小时前
从前端到AI Agent工程师:技能升级与职业跃迁指南
前端·人工智能·ai编程