refactor(login): page styling
This commit is contained in:
parent
64bd361b57
commit
4d781775e3
8 changed files with 66 additions and 43 deletions
|
@ -1,10 +1,3 @@
|
||||||
import { handlers } from '@/auth';
|
import { handlers } from '@/auth';
|
||||||
import { NextRequest, NextResponse } from 'next/server';
|
|
||||||
|
|
||||||
export const { GET, POST } = handlers;
|
export const { GET, POST } = handlers;
|
||||||
|
|
||||||
export async function middleware(request: NextRequest) {
|
|
||||||
if (request.nextUrl.pathname === '/') {
|
|
||||||
return NextResponse.redirect(new URL('/login', request.url));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,12 +25,20 @@
|
||||||
--textbox-50: rgb(204, 204, 204, 0.5);
|
--textbox-50: rgb(204, 204, 204, 0.5);
|
||||||
--textbox-75: rgb(204, 204, 204, 0.75);
|
--textbox-75: rgb(204, 204, 204, 0.75);
|
||||||
--textbox-100: rgb(204, 204, 204, 1);
|
--textbox-100: rgb(204, 204, 204, 1);
|
||||||
|
|
||||||
|
--base-1: #f3f3f3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
:root {
|
:root {
|
||||||
--background: #0a0a0a;
|
--background: #0a0a0a;
|
||||||
--foreground: #e5e7eb;
|
--foreground: #e5e7eb;
|
||||||
|
|
||||||
|
--textbox-50: rgb(75, 85, 99, 0.5);
|
||||||
|
--textbox-75: rgb(75, 85, 99, 0.75);
|
||||||
|
--textbox-100: rgb(75, 85, 99, 1);
|
||||||
|
|
||||||
|
--base-1: #111111;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,30 @@
|
||||||
/* /home/max/Git/MeetUp/src/app/login/login.module.css */
|
body:has(.loginContainer) {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100svh;
|
||||||
|
}
|
||||||
|
|
||||||
.loginContainer {
|
.loginContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
min-height: 100vh;
|
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
|
width: 300px;
|
||||||
|
|
||||||
|
background-color: var(--base-1);
|
||||||
|
border-radius: 1rem;
|
||||||
|
border: 2px solid var(--foreground);
|
||||||
}
|
}
|
||||||
|
|
||||||
.loginContainer h1 {
|
.loginContainer h1 {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loginContainer form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
|
@ -19,18 +19,21 @@ export default async function LoginPage() {
|
||||||
<div className={style.loginContainer}>
|
<div className={style.loginContainer}>
|
||||||
<h1>Login</h1>
|
<h1>Login</h1>
|
||||||
|
|
||||||
<LabeledInput
|
<form>
|
||||||
type='email'
|
<LabeledInput
|
||||||
size='login'
|
type='email'
|
||||||
label='E-Mail'
|
label='E-Mail'
|
||||||
placeholder='Enter your E-Mail'
|
placeholder='Enter your E-Mail'
|
||||||
/>
|
/>
|
||||||
<LabeledInput
|
<LabeledInput
|
||||||
type='password'
|
type='password'
|
||||||
size='login'
|
label='Password'
|
||||||
label='Password'
|
placeholder='Enter your Password'
|
||||||
placeholder='Enter your Password'
|
/>
|
||||||
/>
|
</form>
|
||||||
|
|
||||||
|
<hr style={{ width: 230 }} />
|
||||||
|
|
||||||
<Login provider='authentik' providerDisplayName='SSO' />
|
<Login provider='authentik' providerDisplayName='SSO' />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,17 +8,22 @@ export default function Button({
|
||||||
children,
|
children,
|
||||||
mode = 'primary',
|
mode = 'primary',
|
||||||
icon,
|
icon,
|
||||||
|
width,
|
||||||
}: {
|
}: {
|
||||||
type?: 'button' | 'submit' | 'reset';
|
type?: 'button' | 'submit' | 'reset';
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
mode?: 'primary' | 'warning' | 'success' | 'danger';
|
mode?: 'primary' | 'warning' | 'success' | 'danger';
|
||||||
icon?: IconProp;
|
icon?: IconProp;
|
||||||
|
width?: number;
|
||||||
}) {
|
}) {
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className={style.button + ' ' + style['style_' + mode]}
|
className={style.button + ' ' + style['style_' + mode]}
|
||||||
type={type}
|
type={type}
|
||||||
|
style={{
|
||||||
|
width: width ? `${width}px` : '100%',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<span>{children}</span>
|
<span>{children}</span>
|
||||||
</button>
|
</button>
|
||||||
|
@ -30,6 +35,9 @@ export default function Button({
|
||||||
style.button + ' ' + style['style_' + mode] + ' ' + style['icon']
|
style.button + ' ' + style['style_' + mode] + ' ' + style['icon']
|
||||||
}
|
}
|
||||||
type={type}
|
type={type}
|
||||||
|
style={{
|
||||||
|
width: width ? `${width}px` : '100%',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={icon} height={25} />
|
<FontAwesomeIcon icon={icon} height={25} />
|
||||||
<span>{children}</span>
|
<span>{children}</span>
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
height: 50px;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
|
width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input input {
|
.input input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 50px;
|
||||||
border: 1px solid var(--textbox-75);
|
border: 1px solid var(--textbox-75);
|
||||||
border-radius: 9999px;
|
border-radius: 9999px;
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
|
|
|
@ -2,52 +2,47 @@ import style from './labeled-input.module.css';
|
||||||
|
|
||||||
export default function LabeledInput({
|
export default function LabeledInput({
|
||||||
type,
|
type,
|
||||||
size = 'default',
|
width,
|
||||||
label,
|
label,
|
||||||
placeholder,
|
placeholder,
|
||||||
value,
|
value,
|
||||||
}: {
|
}: {
|
||||||
type: 'text' | 'email' | 'password';
|
type: 'text' | 'email' | 'password';
|
||||||
size: 'default' | 'login' | 'settings';
|
width?: number;
|
||||||
label?: string;
|
label?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
}) {
|
}) {
|
||||||
|
const randomId = Math.random().toString(36).substring(2, 15);
|
||||||
|
|
||||||
if (!label) {
|
if (!label) {
|
||||||
return (
|
return (
|
||||||
<div className={style.input}>
|
<div className={style.input}>
|
||||||
<input
|
<input
|
||||||
type={type}
|
type={type}
|
||||||
className={
|
|
||||||
style['input'] +
|
|
||||||
' ' +
|
|
||||||
style['size_' + size] +
|
|
||||||
' ' +
|
|
||||||
style['type_' + type]
|
|
||||||
}
|
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
defaultValue={value}
|
defaultValue={value}
|
||||||
|
style={{
|
||||||
|
width: width ? `${width}px` : '100%',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<div className={style.input}>
|
<div className={style.input}>
|
||||||
<p>
|
<label htmlFor={randomId} className={style['label']}>
|
||||||
<label className={style['label']}>{label}</label>
|
{label}
|
||||||
</p>
|
</label>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
|
id={randomId}
|
||||||
type={type}
|
type={type}
|
||||||
className={
|
|
||||||
style['input'] +
|
|
||||||
' ' +
|
|
||||||
style['size_' + size] +
|
|
||||||
' ' +
|
|
||||||
style['type_' + type]
|
|
||||||
}
|
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
defaultValue={value}
|
defaultValue={value}
|
||||||
|
style={{
|
||||||
|
width: width ? `${width}px` : '100%',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,7 +16,7 @@ export default function Login({
|
||||||
await signIn(provider);
|
await signIn(provider);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button type='submit' mode='warning' icon={faOpenid}>
|
<Button type='submit' mode='warning' icon={faOpenid} width={250}>
|
||||||
Login with {providerDisplayName}
|
Login with {providerDisplayName}
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue