add provider
This commit is contained in:
parent
967c2f94f2
commit
82cc4dab87
@ -1,7 +1,8 @@
|
|||||||
import { useRef } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import Draggable from 'react-draggable';
|
import Draggable from 'react-draggable';
|
||||||
import { clsxMerge } from '../clsx';
|
import { clsxMerge } from '../clsx';
|
||||||
import { Resizable } from 're-resizable';
|
import { Resizable } from 're-resizable';
|
||||||
|
import { X } from 'lucide-react';
|
||||||
|
|
||||||
type DragModalProps = {
|
type DragModalProps = {
|
||||||
title?: React.ReactNode;
|
title?: React.ReactNode;
|
||||||
@ -63,3 +64,40 @@ export const DragModal = (props: DragModalProps) => {
|
|||||||
</Draggable>
|
</Draggable>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type DragModalTitleProps = {
|
||||||
|
title?: React.ReactNode;
|
||||||
|
className?: string;
|
||||||
|
onClose?: () => void;
|
||||||
|
children?: React.ReactNode;
|
||||||
|
};
|
||||||
|
export const DragModalTitle = (props: DragModalTitleProps) => {
|
||||||
|
return (
|
||||||
|
<div className={clsxMerge('flex flex-row items-center justify-between', props.className)}>
|
||||||
|
<div className='text-sm font-medium text-gray-700'>
|
||||||
|
{props.title}
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
<X className='w-4 h-4 text-gray-500 cursor-pointer' onClick={props.onClose} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getComputedHeight = () => {
|
||||||
|
const height = window.innerHeight;
|
||||||
|
const width = window.innerWidth;
|
||||||
|
return { height, width };
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useComputedHeight = () => {
|
||||||
|
const [computedHeight, setComputedHeight] = useState({
|
||||||
|
height: 0,
|
||||||
|
width: 0,
|
||||||
|
});
|
||||||
|
useEffect(() => {
|
||||||
|
const height = window.innerHeight;
|
||||||
|
const width = window.innerWidth;
|
||||||
|
setComputedHeight({ height, width });
|
||||||
|
}, []);
|
||||||
|
return computedHeight;
|
||||||
|
};
|
||||||
|
@ -8,8 +8,9 @@ type TagsInputProps = {
|
|||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
label?: any;
|
label?: any;
|
||||||
showLabel?: boolean;
|
showLabel?: boolean;
|
||||||
|
options?: string[];
|
||||||
};
|
};
|
||||||
export const TagsInput = ({ value, onChange, placeholder = '', label = '', showLabel = false }: TagsInputProps) => {
|
export const TagsInput = ({ value, onChange, placeholder = '', label = '', showLabel = false, options = [] }: TagsInputProps) => {
|
||||||
const [tags, setTags] = useState<string[]>(value);
|
const [tags, setTags] = useState<string[]>(value);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTags(value);
|
setTags(value);
|
||||||
@ -21,7 +22,7 @@ export const TagsInput = ({ value, onChange, placeholder = '', label = '', showL
|
|||||||
<Autocomplete
|
<Autocomplete
|
||||||
multiple
|
multiple
|
||||||
freeSolo
|
freeSolo
|
||||||
options={[]}
|
options={options || []}
|
||||||
value={tags}
|
value={tags}
|
||||||
onChange={(event, newValue) => {
|
onChange={(event, newValue) => {
|
||||||
// setTags(newValue as string[]);
|
// setTags(newValue as string[]);
|
||||||
|
13
src/theme/Provider.tsx
Normal file
13
src/theme/Provider.tsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { ToastContainer } from 'react-toastify';
|
||||||
|
|
||||||
|
type ToastProviderProps = {
|
||||||
|
children?: React.ReactNode;
|
||||||
|
};
|
||||||
|
export const ToastProvider = ({ children }: ToastProviderProps) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{children}
|
||||||
|
<ToastContainer />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user