Merged in feat/LOY-484-consent-alert (pull request #3184)
feat(LOY-484): Change toast to alert for Profiling Consent * feat(LOY-484): change toast to alert using context * refactor(LOY-484): remove uneccesary code * chore(LOY-484): small UI fixes Approved-by: Chuma Mcphoy (We Ahead)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"use client"
|
||||
import { createContext, type ReactNode, useContext, useState } from "react"
|
||||
|
||||
import type { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
||||
|
||||
type AlertType = AlertTypeEnum.Success | AlertTypeEnum.Alarm
|
||||
|
||||
const ProfilingConsentAlertContext = createContext<{
|
||||
alertType: AlertType | null
|
||||
setAlertType: (data: AlertType | null) => void
|
||||
}>({
|
||||
alertType: null,
|
||||
setAlertType: () => {},
|
||||
})
|
||||
|
||||
export function ProfilingConsentAlertProvider({
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode
|
||||
}) {
|
||||
const [alertType, setAlertType] = useState<AlertType | null>(null)
|
||||
return (
|
||||
<ProfilingConsentAlertContext.Provider value={{ alertType, setAlertType }}>
|
||||
{children}
|
||||
</ProfilingConsentAlertContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
export const useProfilingConsentAlert = () =>
|
||||
useContext(ProfilingConsentAlertContext)
|
||||
Reference in New Issue
Block a user