Skip to content

Commit

Permalink
⭐ feat: initiate modal provider, create dataTypes and modalContext.
Browse files Browse the repository at this point in the history
  • Loading branch information
yashdev9274 committed Jun 14, 2024
1 parent 53ce17e commit c9b2c8c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/providers/modal-provider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use client"

import { Agency, User } from "@prisma/client"
import React, { createContext } from "react";

interface ModalProviderProps {
children: React.ReactNode
}

export type ModalData = {
user?: User;
agency?: Agency;
}

type ModalContextType = {
data: ModalData
isOpen: boolean
setOpen: (modal: React.ReactNode, fetchData?: () => Promise<any>) => void
setClose: () => void
}

export const ModalContext = createContext<ModalContextType>({
data: {},
isOpen: false,
setOpen: (modal: React.ReactNode, fetchData?: () => Promise<any>) => { },
setClose: () => { }
})

0 comments on commit c9b2c8c

Please sign in to comment.