el.xwx.moe/layouts/CenteredForm.tsx

53 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-11-24 06:50:16 -06:00
import useLocalSettingsStore from "@/store/localSettings";
2023-08-01 15:20:05 -05:00
import Image from "next/image";
2023-08-15 20:29:38 -05:00
import Link from "next/link";
2023-11-26 04:17:08 -06:00
import React, { ReactNode, useEffect } from "react";
2023-08-01 15:20:05 -05:00
interface Props {
text?: string;
children: ReactNode;
"data-testid"?: string;
2023-08-01 15:20:05 -05:00
}
export default function CenteredForm({
text,
children,
"data-testid": dataTestId,
}: Props) {
2023-11-24 06:50:16 -06:00
const { settings } = useLocalSettingsStore();
2023-11-26 04:17:08 -06:00
2023-08-01 15:20:05 -05:00
return (
<div
className="absolute top-0 bottom-0 left-0 right-0 flex justify-center items-center p-5"
data-testid={dataTestId}
>
<div className="m-auto flex flex-col gap-2 w-full">
2023-11-26 04:17:08 -06:00
{settings.theme ? (
<Image
2023-11-24 06:50:16 -06:00
src={`/linkwarden_${
settings.theme === "dark" ? "dark" : "light"
}.png`}
width={640}
height={136}
alt="Linkwarden"
className="h-12 w-fit mx-auto"
/>
) : undefined}
2023-08-01 15:20:05 -05:00
{text ? (
2023-11-24 07:39:55 -06:00
<p className="text-lg max-w-[30rem] min-w-80 w-full mx-auto font-semibold px-2 text-center">
2023-08-01 15:20:05 -05:00
{text}
</p>
) : undefined}
{children}
2023-11-26 04:17:08 -06:00
<p className="text-center text-xs text-neutral mb-5">
2023-08-15 20:29:38 -05:00
© {new Date().getFullYear()}{" "}
<Link href="https://linkwarden.app" className="font-semibold">
Linkwarden
</Link>
. All rights reserved.
2023-08-01 15:20:05 -05:00
</p>
</div>
</div>
);
}