Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial work on modal component
- Loading branch information
1 parent
9bef530
commit 0571578
Showing
6 changed files
with
53 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './modal' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { FC } from 'react' | ||
import { Dialog } from '@headlessui/react' | ||
|
||
// const { Description, Overlay, Title } = Dialog | ||
|
||
const Modal: FC<ModalProps> = ({ | ||
children, | ||
open, | ||
onClose, | ||
// destroy, | ||
initialFocus, | ||
unmount, | ||
as | ||
}) => { | ||
return ( | ||
<Dialog | ||
onClose={onClose} | ||
// static={destroy} | ||
unmount={unmount} | ||
as={as} | ||
initialFocus={initialFocus} | ||
open={open} | ||
> | ||
{children} | ||
</Dialog> | ||
) | ||
} | ||
|
||
type ModalProps = PrimitiveModalProps | ||
|
||
interface PrimitiveModalProps { | ||
open: boolean | undefined | ||
onClose: (item: false) => void | ||
destroy?: boolean | ||
unmount?: boolean | ||
as?: React.ElementType<any> | ||
initialFocus?: React.MutableRefObject<any> | ||
} | ||
|
||
export { Modal } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters