Skip to content
Open
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
46 changes: 22 additions & 24 deletions app/(pages)/_components/AuthForm/AuthForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import Link from 'next/link';
import Image from 'next/image';

import useAuthForm from '@hooks/useAuthForm';
import Froggy from 'public/judges/login/LogIn_Froggy.svg';
import Drumstick from 'public/judges/login/LogIn_DrumStick.svg';
import arrowRight from '@public/icons/arrow-right.svg';
import hackerStyles from './HackerAuthForm.module.scss';
import judgeStyles from './JudgeAuthForm.module.scss';

Expand Down Expand Up @@ -55,6 +54,14 @@ export default function AuthForm({
onSuccess,
});

const hasTypedInput = fields.some((field) => {
if (field.type === 'checkbox') {
return false;
}
const value = formValues[field.name];
return String(value ?? '').trim().length > 0;
});

return (
<div className={styles.container}>
<form onSubmit={handleSubmit} className={styles.form}>
Expand Down Expand Up @@ -98,35 +105,26 @@ export default function AuthForm({
</div>

<div className={styles.bottom_container}>
{role === 'judge' && (
<div className={styles.froggy_container}>
<Image
src={Drumstick}
alt="froggy_drumstick"
width={10}
height={10}
className={styles.drumstick}
/>
<Image
src={Froggy}
alt="froggy"
width={50}
height={50}
className={styles.froggy}
/>
</div>
)}

<div className={styles.bottom}>
<div />
<button
type="submit"
disabled={loading || !valid}
className={`${styles.submit_button} ${
valid ? styles.valid : null
}`}
role === 'judge' && hasTypedInput ? styles.filled : null
} ${valid ? styles.valid : null}`}
>
{loading ? 'Checking...' : buttonText}
<span className={styles.submit_content}>
{loading ? 'Checking...' : buttonText}
{role === 'judge' ? (
<Image
src={arrowRight}
alt=""
aria-hidden="true"
className={styles.submit_arrow}
/>
) : null}
</span>
</button>
</div>
<p className={styles.error_msg}>{errors.submit}</p>
Expand Down
114 changes: 78 additions & 36 deletions app/(pages)/_components/AuthForm/JudgeAuthForm.module.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
.container {
width: 100%;
height: 60vh;
border-radius: var(--b-radius);
display: flex;
height: 100%;
min-height: 100%;
border-radius: 28px;
color: #000;
}

.form {
display: flex;
flex-direction: column;
align-items: space-between;
justify-content: flex-start;
height: 100%;
width: 100%;
color: #000;

.input_container {
position: relative;
Expand Down Expand Up @@ -39,16 +44,22 @@
}

input {
padding-top: var(--small-medium-spacer);
padding-left: var(--small-spacer);
height: 76px;
border: 1.5px solid #5e5e65;
border-radius: 16px;
background: #fff;
padding: 30px 16px 10px 16px;
width: 100%;
font-size: 1.75rem;
color: #000;
}

label {
position: absolute;
margin-top: var(--tiny-spacer);
left: var(--small-spacer);
font-size: 0.9rem;
top: 10px;
left: 16px;
font-size: 0.95rem;
color: #8b8b8b;
pointer-events: none;
}
}
Expand All @@ -63,7 +74,14 @@
.fields {
display: flex;
flex-direction: column;
gap: var(--small-spacer);
gap: 20px;
}

.top_container {
color: #000;
display: flex;
flex-direction: column;
gap: 8px;
}

.error {
Expand All @@ -72,49 +90,73 @@

.bottom_container {
display: flex;
justify-content: center;
justify-content: flex-end;
margin-top: auto;
flex-direction: column;
padding-top: 24px;
}

.bottom {
width: 100%;
}

.submit_button {
padding: 15px 18px;
font-size: 1.125rem;
padding: 12px 24px;
font-size: 1.5rem;
font-weight: 700;
line-height: normal;
color: var(--text-light);
border: none;
border-radius: var(--b-radius);
background-color: var(--background-secondary-light);
color: #000;
border: 1px solid #e6e6ef;
border-radius: 9999px;
background-color: #fff;
cursor: not-allowed;
width: 100%;
opacity: 0.7;
opacity: 1;
}

.valid {
background-color: var(--background-secondary);
opacity: 1;
cursor: pointer;
.submit_content {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 12px;
}

.froggy_container {
// display: flex;
justify-content: flex-end;
position: relative;
.submit_arrow {
width: 22px;
height: 22px;
filter: brightness(0);
}

img {
position: absolute;
}
.filled {
background-color: #000;
color: #fff;
border-color: #000;

.froggy {
z-index: 1;
left: 280px;
top: -59px;
.submit_arrow {
filter: brightness(0) invert(1);
}
}

.valid {
background-color: #000;
color: #fff;
border-color: #000;
opacity: 1;
cursor: pointer;

.drumstick {
z-index: 2;
left: 277px;
top: -47px;
.submit_arrow {
filter: brightness(0) invert(1);
}
}

.froggy_container {
display: none;
}

.forgot {
color: #000;
text-align: center;
text-decoration: none;
font-size: 1rem;
margin-top: 8px;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,85 @@
.container {
min-height: 100vh;
display: flex;
flex-direction: column;
padding: var(--spacer) var(--small-spacer);
align-content: space-around;
height: 100vh;
justify-content: center;
align-items: center;
padding: 32px 24px 48px;
background: #fafaff;
color: #000;
}

.section {
margin-bottom: var(--spacer);
}
width: min(100%, 560px);
}

.logo_section {
display: flex;
justify-content: center;
margin-bottom: 40px;
}

.logo_container {
position: relative;
width: 128px;
height: 128px;
display: inline-flex;
align-items: center;
justify-content: center;
}

.logo_container::before {
content: '';
position: absolute;
inset: 0;
background: url('/judges/login/pink_cloud.svg') center/contain no-repeat;
animation: spin_cloud 12s linear infinite;
}

.logo_container :global(img) {
width: 74px;
height: 74px;
position: relative;
z-index: 1;
filter: brightness(0) invert(1);
}

.title_section {
text-align: center;
margin-bottom: 28px;
}

.title_section h3 {
font-size: clamp(2rem, 5vw, 3.5rem);
line-height: 1.05;
margin: 0 0 12px;
color: #000;
}

.title_section p {
margin: 0;
font-size: clamp(1rem, 2.6vw, 1.75rem);
color: #4e4e54;
}

.form_section {
width: min(100%, 560px);
height: 48vh;
display: flex;
justify-content: space-between;
}

.form_section > div {
width: 100%;
height: 100%;
}

@keyframes spin_cloud {
from {
transform: rotate(0deg);
}

to {
transform: rotate(360deg);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@ export default async function AuthFormBackground({
}) {
return (
<div className={styles.container}>
<div className={styles.section}>
<Image src={hd_logo} alt="hd_logo" height={50} width={50} />
<div className={`${styles.section} ${styles.logo_section}`}>
<div className={styles.logo_container}>
<Image src={hd_logo} alt="hd_logo" height={74} width={74} />
</div>
</div>

<div className={styles.section}>
<div className={`${styles.section} ${styles.title_section}`}>
<h3>
<b>{title}</b>
</h3>
<p style={{ whiteSpace: 'pre-line' }}>{subtitle}</p>
</div>

<div className={styles.section}>{children}</div>
<div className={`${styles.section} ${styles.form_section}`}>
{children}
</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function ForgotPasswordForm() {
<AuthForm
role="judge"
fields={formFields}
buttonText="Send Email"
buttonText="Send Email"
initialValues={{
email: '',
}}
Expand Down
4 changes: 2 additions & 2 deletions app/(pages)/judges/_components/AuthForms/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function LoginForm() {
{
name: 'email' as const,
type: 'email',
label: 'Email',
label: 'Username',
placeholder: '',
readOnly: false,
},
Expand All @@ -37,7 +37,7 @@ export default function LoginForm() {
<AuthForm
role="judge"
fields={formFields}
buttonText="Log in"
buttonText="Log in"
linkText="Forgot Password?"
linkHref="/judges/login/forgot-password"
initialValues={{
Expand Down
3 changes: 3 additions & 0 deletions public/judges/login/pink_cloud.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading