2022-06-11 03:08:49 +00:00
|
|
|
import { ImageProps } from "next/image"
|
2022-06-07 10:48:47 +00:00
|
|
|
import { createDefinedContext } from "../../utils/definedContext";
|
|
|
|
|
|
|
|
|
2022-06-09 21:43:38 +00:00
|
|
|
/**
|
2022-06-11 03:08:49 +00:00
|
|
|
* The string to be used as the `src` of the postcard.
|
2022-06-09 21:43:38 +00:00
|
|
|
*/
|
2022-06-11 03:08:49 +00:00
|
|
|
export type PostcardSource = ImageProps["src"]
|
2022-06-09 21:43:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How the postcard is displayed on the page.
|
|
|
|
*/
|
|
|
|
export enum PostcardVisibility {
|
|
|
|
/**
|
|
|
|
* The postcard is filtered, blurred, and rendered behind all elements on the page.
|
|
|
|
*/
|
|
|
|
BACKGROUND = "background",
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The postcard is fully visible and rendered above all other elements.
|
|
|
|
*/
|
|
|
|
FOREGROUND = "foreground",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Contents of the {@link PostcardContext}.
|
|
|
|
*/
|
2022-06-11 03:08:49 +00:00
|
|
|
export type PostcardContextContents = {
|
|
|
|
src: PostcardSource,
|
|
|
|
setSrc: React.Dispatch<React.SetStateAction<PostcardSource>>,
|
2022-06-09 21:43:38 +00:00
|
|
|
visibility: PostcardVisibility,
|
|
|
|
setVisibility: React.Dispatch<React.SetStateAction<PostcardVisibility>>,
|
2022-06-07 10:48:47 +00:00
|
|
|
}
|
2022-06-04 03:13:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Context containing data about the website's current postcard, the blurred background image.
|
|
|
|
*/
|
2022-06-11 03:08:49 +00:00
|
|
|
export const PostcardContext = createDefinedContext<PostcardContextContents>()
|
|
|
|
|
|
|
|
|
|
|
|
|