2022-07-17 01:49:37 +00:00
|
|
|
import React from "react"
|
|
|
|
import { PostcardContext, PostcardSource } from "./base"
|
2022-07-20 21:53:08 +00:00
|
|
|
import { usePostcardStorage } from "./storage"
|
2022-07-17 01:49:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
export type PostcardContextProviderProps = {
|
|
|
|
defaultPostcard: PostcardSource,
|
|
|
|
children: React.ReactNode,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const PostcardContextProvider = ({ defaultPostcard, children }: PostcardContextProviderProps) => {
|
|
|
|
return (
|
2022-07-20 21:53:08 +00:00
|
|
|
<PostcardContext.Provider value={usePostcardStorage(defaultPostcard)}>
|
2022-07-17 01:49:37 +00:00
|
|
|
{children}
|
|
|
|
</PostcardContext.Provider>
|
|
|
|
)
|
|
|
|
}
|