feat: unify authentication pages
This commit is contained in:
8 files changed
+110
-80
No files matched your search
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Alert, Button, Group, Paper, Stack, Text, TextInput, ThemeIcon, Title } from "@mantine/core";
|
||||
import { Alert, Button, Stack, Text, TextInput } from "@mantine/core";
|
||||
import { IconArrowRight, IconShieldCheck, IconUserPlus } from "@tabler/icons-react";
|
||||
import type { z } from "zod/v4";
|
||||
|
||||
@@ -17,10 +17,9 @@ import { groupCreateSchema } from "@homarr/validation/group";
|
||||
import { userInitSchema } from "@homarr/validation/user";
|
||||
|
||||
import { didCredentialsSignInFail } from "./account-recovery";
|
||||
import { OnboardingBackdrop } from "./onboarding-backdrop";
|
||||
import { OnboardingAuthShell } from "./onboarding-auth-shell";
|
||||
import type { OnboardingStudioProps } from "./types";
|
||||
import { useOnboardingSounds } from "./use-onboarding-sounds";
|
||||
import classes from "./onboarding-studio.module.css";
|
||||
|
||||
const AccountShell = ({
|
||||
title,
|
||||
@@ -31,29 +30,9 @@ const AccountShell = ({
|
||||
description: string;
|
||||
children: React.ReactNode;
|
||||
}) => (
|
||||
<main className={classes.page}>
|
||||
<OnboardingBackdrop />
|
||||
<div className={classes.shell}>
|
||||
<Stack mih="calc(100dvh - 6rem)" justify="center" align="center">
|
||||
<Paper className={classes.studio} radius="lg" p={{ base: "lg", sm: "xl" }} w="100%" maw="36rem">
|
||||
<Stack gap="xl">
|
||||
<Group wrap="nowrap" align="flex-start">
|
||||
<ThemeIcon size="xl" radius="lg" variant="light">
|
||||
<IconShieldCheck size={24} />
|
||||
</ThemeIcon>
|
||||
<Stack gap={4}>
|
||||
<Title order={1} size="h2">
|
||||
{title}
|
||||
</Title>
|
||||
<Text c="dimmed">{description}</Text>
|
||||
</Stack>
|
||||
</Group>
|
||||
{children}
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Stack>
|
||||
</div>
|
||||
</main>
|
||||
<OnboardingAuthShell title={title} description={description} icon={<IconShieldCheck size={24} />}>
|
||||
{children}
|
||||
</OnboardingAuthShell>
|
||||
);
|
||||
|
||||
export const AccountSetup = ({ environment }: OnboardingStudioProps) => {
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export { OnboardingAuthShell } from "./onboarding-auth-shell";
|
||||
export { OnboardingStudio } from "./onboarding-studio";
|
||||
export type { OnboardingEnvironment, OnboardingStudioProps } from "./types";
|
||||
@@ -0,0 +1,48 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { Group, Paper, Stack, Text, ThemeIcon, Title } from "@mantine/core";
|
||||
|
||||
import { OnboardingBackdrop } from "./onboarding-backdrop";
|
||||
import { OnboardingWordmark } from "./onboarding-wordmark";
|
||||
import classes from "./onboarding-studio.module.css";
|
||||
|
||||
interface OnboardingAuthShellProps {
|
||||
title: ReactNode;
|
||||
description: ReactNode;
|
||||
icon: ReactNode;
|
||||
children: ReactNode;
|
||||
footer?: ReactNode;
|
||||
}
|
||||
|
||||
export const OnboardingAuthShell = ({ title, description, icon, children, footer }: OnboardingAuthShellProps) => (
|
||||
<main className={classes.page}>
|
||||
<OnboardingBackdrop />
|
||||
<div className={`${classes.shell} ${classes.authShell}`}>
|
||||
<Stack className={classes.authLayout} gap="xl" align="center" justify="center">
|
||||
<div className={classes.authBrand}>
|
||||
<OnboardingWordmark large />
|
||||
</div>
|
||||
<Paper className={`${classes.studio} ${classes.authCard}`} radius="lg" p={{ base: "lg", sm: "xl" }}>
|
||||
<Stack gap="xl">
|
||||
<Group wrap="nowrap" align="flex-start">
|
||||
<ThemeIcon size="xl" radius="lg" variant="light">
|
||||
{icon}
|
||||
</ThemeIcon>
|
||||
<Stack gap={4}>
|
||||
<Title order={1} size="h2">
|
||||
{title}
|
||||
</Title>
|
||||
<Text c="dimmed">{description}</Text>
|
||||
</Stack>
|
||||
</Group>
|
||||
{children}
|
||||
</Stack>
|
||||
</Paper>
|
||||
{footer ? (
|
||||
<Text className={classes.authFooter} size="sm" c="dimmed" ta="center">
|
||||
{footer}
|
||||
</Text>
|
||||
) : null}
|
||||
</Stack>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
@@ -129,6 +129,31 @@
|
||||
overflow: clip;
|
||||
}
|
||||
|
||||
.authShell {
|
||||
display: grid;
|
||||
min-height: 100dvh;
|
||||
padding-block: clamp(1rem, 4vw, 3rem) calc(clamp(1rem, 4vw, 3rem) + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.authLayout {
|
||||
width: min(100%, 36rem);
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.authBrand {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.authCard {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.authFooter {
|
||||
max-width: 32rem;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.studioGrid {
|
||||
display: grid;
|
||||
grid-template-columns: 15rem minmax(0, 1fr);
|
||||
|
||||
Reference in new issue
Block a user