diff --git a/components/postcard/base.ts b/components/postcard/base.ts index 2f844fd..35ac24c 100644 --- a/components/postcard/base.ts +++ b/components/postcard/base.ts @@ -40,19 +40,3 @@ export type PostcardContextContents = { * Context containing data about the website's current postcard, the blurred background image. */ 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 new file mode 100644 index 0000000..c1e792e --- /dev/null +++ b/components/postcard/storage.ts @@ -0,0 +1,17 @@ +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, + }; +}