el.xwx.moe/layouts/CenteredForm.tsx

55 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";
import React, { ReactNode } from "react";
2024-06-09 08:27:16 -05:00
import { Trans } from "next-i18next";
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">
{settings.theme && (
<Image
src={`/linkwarden_${settings.theme === "dark" ? "dark" : "light"
}.png`}
width={640}
height={136}
alt="Linkwarden"
className="h-12 w-fit mx-auto"
/>
)}
{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>
)}
2023-08-01 15:20:05 -05:00
{children}
2023-11-26 04:17:08 -06:00
<p className="text-center text-xs text-neutral mb-5">
2024-06-09 08:27:16 -05:00
<Trans
values={{ date: new Date().getFullYear() }}
i18nKey="all_rights_reserved"
components={[
<Link href="https://linkwarden.app" className="font-semibold" />,
]}
/>
2023-08-01 15:20:05 -05:00
</p>
</div>
</div>
);
}