mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-23 15:14:23 +00:00
18 lines
499 B
TypeScript
18 lines
499 B
TypeScript
|
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,
|
||
|
};
|
||
|
}
|