1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 15:14:23 +00:00
festa/components/postcard/storage.ts

18 lines
499 B
TypeScript
Raw Normal View History

2022-06-11 03:08:49 +00:00
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<PostcardSource>(defaultPostcard);
const [visibility, setVisibility] = useState<PostcardVisibility>(PostcardVisibility.BACKGROUND);
return {
src,
setSrc,
visibility,
setVisibility,
};
}