mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-23 07:04:22 +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,
|
||
|
};
|
||
|
}
|