init commit for iPAL-kit plugin

This commit is contained in:
2026-07-18 20:30:23 +02:00
parent 10638127a9
commit 5733a9c8bf
119 changed files with 6892 additions and 411 deletions
+21
View File
@@ -0,0 +1,21 @@
'use client'
import { createContext, type ReactNode, use } from 'react'
import type { ConsentTexts } from './texts.js'
import { useConsent } from './useConsent.js'
type ConsentContextValue = { texts: ConsentTexts } & ReturnType<typeof useConsent>
const ConsentContext = createContext<ConsentContextValue | null>(null)
export function ConsentProvider({ children, texts }: { children: ReactNode; texts: ConsentTexts }) {
const consent = useConsent()
return <ConsentContext value={{ ...consent, texts }}>{children}</ConsentContext>
}
export function useConsentContext(): ConsentContextValue {
const ctx = use(ConsentContext)
if (!ctx) {throw new Error('useConsentContext must be used within ConsentProvider')}
return ctx
}