generated from template/astro-template
temp
This commit is contained in:
@@ -115,3 +115,18 @@ export const useComputedHeight = () => {
|
||||
}, []);
|
||||
return computedHeight;
|
||||
};
|
||||
|
||||
export const useDragSize = (width = 600, heigth = 400) => {
|
||||
const computedHeight = getComputedHeight();
|
||||
const isMin = computedHeight.width < width;
|
||||
return {
|
||||
defaultSize: {
|
||||
width: isMin ? computedHeight.width : 600,
|
||||
height: 400,
|
||||
},
|
||||
style: {
|
||||
left: isMin ? 0 : computedHeight.width / 2 - width / 2,
|
||||
top: computedHeight.height / 2 - heigth / 2,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
24
src/components/a/modal.tsx
Normal file
24
src/components/a/modal.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/dialog';
|
||||
import React, { Dispatch, SetStateAction } from 'react';
|
||||
|
||||
type ModalProps = {
|
||||
open?: boolean;
|
||||
setOpen?: (open: boolean) => any;
|
||||
title?: string;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
export const Modal = (props: ModalProps) => {
|
||||
const { open = false, setOpen, title, children } = props;
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
</DialogHeader>
|
||||
{children}
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
@@ -5,6 +5,7 @@
|
||||
<html lang='zh-CN'>
|
||||
<head>
|
||||
<meta charset='UTF-8' />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AI Pages</title>
|
||||
<style>
|
||||
html,
|
||||
|
||||
Reference in New Issue
Block a user