mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-22 14:44:21 +00:00
Move useStatePostcard to components/postcard/base
This commit is contained in:
parent
e6e667a1d3
commit
3c597158c8
2 changed files with 14 additions and 17 deletions
|
@ -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<PostcardContextContents>()
|
||||
|
||||
|
||||
/**
|
||||
* 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,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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<PostcardSource>(defaultPostcard);
|
||||
const [visibility, setVisibility] = useState<PostcardVisibility>(PostcardVisibility.BACKGROUND);
|
||||
|
||||
return {
|
||||
src,
|
||||
setSrc,
|
||||
visibility,
|
||||
setVisibility,
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue