Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mai/fix-added darkmode changes for register #445

Merged
merged 6 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/(main)/register/page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,9 @@ describe('Register', () => {
);
});
});
test('renders Register component in dark mode using global css styles for background and foreground', () => {
const darkModeSection = screen.getByTestId('dark-mode-section');

expect(darkModeSection).toHaveClass('dark:bg-gradient-to-b');
});
});
201 changes: 99 additions & 102 deletions app/(main)/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,115 +125,112 @@ const Register = (): JSX.Element => {
const isDisabled = !email || !password || password !== confirmPassword;

return (
<div className="h-screen w-full">
<div className="grid h-screen w-full grid-cols-2 bg-gradient-to-b from-[#4E160E] to-zinc-950">
<div className="grid p-8">
<div className="grid">
<Logo className="mx-auto place-self-end" src={logo} />
</div>
<div className="mx-auto grid gap-4 place-self-end">
<p className="leading-7 text-white">
Thank you... fantasy football draft, for letting me know that even
in my fantasies, I am bad at sports.
</p>
<p className="leading-7 text-white">Jimmy Fallon</p>
</div>
<section className="grid xl:grid-cols-2 xl:grid-rows-none">
<div
data-testid="dark-mode-section"
className="row-span-1 grid w-full place-items-center from-[#4E160E] to-zinc-950 dark:bg-gradient-to-b xl:h-screen xl:bg-gradient-to-b"
>
<Logo className="mx-auto w-52 xl:w-64 xl:place-self-end" src={logo} />
<div className="mx-auto grid gap-4 place-self-end px-8 pb-8 text-foreground text-white">
<p className="hidden leading-7 xl:block">
Thank you... fantasy football draft, for letting me know that even
in my fantasies, I am bad at sports.
</p>
<p className="hidden leading-7 xl:block">Jimmy Fallon</p>
</div>
</div>
<div className="row-span-1 mx-auto grid max-w-sm justify-center space-y-4 px-4 xl:flex xl:flex-col">
<div>
<h1 className="text-5xl font-extrabold tracking-tight text-foreground">
Register A New Account
</h1>
<p className="pb-4 font-normal leading-7 text-zinc-500">
If you have an existing account{' '}
<LinkCustom href="/login">Login!</LinkCustom>
</p>
</div>
<div className="grid place-content-center bg-white p-8">
<div className="mx-auto grid w-80 place-content-center gap-4">
<h1 className="text-5xl font-extrabold tracking-tight text-foreground">
Register A New Account
</h1>
<p className="pb-4 font-normal leading-7 text-zinc-500">
If you have an existing account{' '}
<LinkCustom href="/login">Login!</LinkCustom>
</p>

<Form {...form}>
<form
id="input-container"
className="grid gap-3"
onSubmit={form.handleSubmit(onSubmit)}
>
<FormField
control={form.control as Control<object>}
name="email"
render={({ field }) => (
<FormItem>
<FormControl>
<Input
data-testid="email"
type="email"
placeholder="Email"
{...field}
/>
</FormControl>
{form.formState.errors.email && (
<FormMessage>
{form.formState.errors.email.message}
</FormMessage>
)}
</FormItem>
<Form {...form}>
<form
id="input-container"
className="grid gap-3"
onSubmit={form.handleSubmit(onSubmit)}
>
<FormField
control={form.control as Control<object>}
name="email"
render={({ field }) => (
<FormItem>
<FormControl>
<Input
data-testid="email"
type="email"
placeholder="Email"
{...field}
/>
</FormControl>
{form.formState.errors.email && (
<FormMessage>
{form.formState.errors.email.message}
</FormMessage>
)}
/>
<FormField
control={form.control as Control<object>}
name="password"
render={({ field }) => (
<FormItem>
<FormControl>
<Input
data-testid="password"
type="password"
placeholder="Password"
{...field}
/>
</FormControl>
{form.formState.errors.password && (
<FormMessage>
{form.formState.errors.password.message}
</FormMessage>
)}
</FormItem>
</FormItem>
)}
/>
<FormField
control={form.control as Control<object>}
name="password"
render={({ field }) => (
<FormItem>
<FormControl>
<Input
data-testid="password"
type="password"
placeholder="Password"
{...field}
/>
</FormControl>
{form.formState.errors.password && (
<FormMessage>
{form.formState.errors.password.message}
</FormMessage>
)}
/>
<FormField
control={form.control as Control<object>}
name="confirmPassword"
render={({ field }) => (
<FormItem>
<FormControl>
<Input
data-testid="confirm-password"
type="password"
placeholder="Confirm Password"
{...field}
/>
</FormControl>
{form.formState.errors.confirmPassword && (
<FormMessage>
{form.formState.errors.confirmPassword.message}
</FormMessage>
)}
</FormItem>
</FormItem>
)}
/>
<FormField
control={form.control as Control<object>}
name="confirmPassword"
render={({ field }) => (
<FormItem>
<FormControl>
<Input
data-testid="confirm-password"
type="password"
placeholder="Confirm Password"
{...field}
/>
</FormControl>
{form.formState.errors.confirmPassword && (
<FormMessage>
{form.formState.errors.confirmPassword.message}
</FormMessage>
)}
/>
</FormItem>
)}
/>

<Button
data-testid="continue-button"
label="Register"
type="submit"
disabled={isDisabled}
/>
<LinkCustom href="/login">
Login to get started playing
</LinkCustom>
</form>
</Form>
</div>
</div>
<Button
data-testid="continue-button"
label="Register"
type="submit"
disabled={isDisabled}
/>
<LinkCustom href="/login">Login to get started playing</LinkCustom>
</form>
</Form>
</div>
</div>
</section>
);
};

Expand Down