import React, { useState } from 'react'
import { GridLiveRegionContext } from './context'

type GridLiveRegionProviderProps = {
    children: React.ReactNode
}

export const GridLiveRegionProvider = ({
    children,
}: GridLiveRegionProviderProps) => {
    const [announcement, setAnnouncement] = useState('')

    return (
        <GridLiveRegionContext.Provider
            value={{ announcement, setAnnouncement }}
        >
            {children}
        </GridLiveRegionContext.Provider>
    )
}
