diff --git a/components/postcard/base.ts b/components/postcard/base.ts index 70bd414..2f844fd 100644 --- a/components/postcard/base.ts +++ b/components/postcard/base.ts @@ -1,4 +1,5 @@ import { ImageProps } from "next/image" +import { useState } from "react"; import { createDefinedContext } from "../../utils/definedContext"; @@ -41,4 +42,17 @@ export type PostcardContextContents = { export const PostcardContext = createDefinedContext() +/** + * Hook holding as state the {@link PostcardContextContents}. + */ +export function useStatePostcard(defaultPostcard: PostcardSource) { + const [src, setSrc] = useState(defaultPostcard); + const [visibility, setVisibility] = useState(PostcardVisibility.BACKGROUND); + return { + src, + setSrc, + visibility, + setVisibility, + }; +} diff --git a/components/postcard/storage.ts b/components/postcard/storage.ts deleted file mode 100644 index c1e792e..0000000 --- a/components/postcard/storage.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { useState } from "react"; -import { PostcardSource, PostcardVisibility } from "./base"; - -/** - * Hook holding as state the {@link PostcardContextContents}. - */ -export function useStatePostcard(defaultPostcard: PostcardSource) { - const [src, setSrc] = useState(defaultPostcard); - const [visibility, setVisibility] = useState(PostcardVisibility.BACKGROUND); - - return { - src, - setSrc, - visibility, - setVisibility, - }; -}