This commit is contained in:
Eric Bailey
2024-01-13 12:11:25 -06:00
parent 45c807b83b
commit ceef55041a
32 changed files with 729 additions and 525 deletions
+23
View File
@@ -0,0 +1,23 @@
import React from 'react'
import {DialogContextProps, DialogControlProps} from '#/components/Dialog/types'
export const Context = React.createContext<DialogContextProps>({
close: () => {},
})
export function useDialogContext() {
return React.useContext(Context)
}
export function useDialogControl() {
const control = React.useRef<DialogControlProps>({
open: () => {},
close: () => {},
})
return {
ref: control,
open: () => control.current.open(),
close: () => control.current.close(),
}
}