fix: restyle login page

This commit is contained in:
Dominik 2025-05-06 14:01:54 +02:00
parent cda7900fde
commit 14839c0c01
9 changed files with 48 additions and 41 deletions

View file

@ -12,7 +12,7 @@ body:has(.loginContainer) {
justify-content: center; justify-content: center;
gap: 1.5rem; gap: 1.5rem;
padding: 2rem; padding: 2rem;
width: 300px; width: min(max(300px, 30svw), 500px);
background-color: var(--base-1); background-color: var(--base-1);
border-radius: 1rem; border-radius: 1rem;
@ -24,6 +24,7 @@ body:has(.loginContainer) {
} }
.loginContainer form { .loginContainer form {
width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;

View file

@ -1,14 +1,12 @@
// /home/max/Git/MeetUp/src/app/login/page.tsx // /home/max/Git/MeetUp/src/app/login/page.tsx
import { auth } from '@/auth'; import { auth } from '@/auth';
import LabeledInput from '@/components/labeled-input';
import Login from '@/components/user/sso-login-button';
import { redirect } from 'next/navigation'; import { redirect } from 'next/navigation';
import style from './login.module.css'; import style from './login.module.css';
import '@/app/globals.css'; import '@/app/globals.css';
import SSOLogin from '@/components/user/sso-login-button'; import SSOLogin from '@/components/user/sso-login-button';
import Login from '@/components/user/login-button'; import LoginForm from '@/components/user/login-form';
export default async function LoginPage() { export default async function LoginPage() {
const session = await auth(); const session = await auth();
@ -21,24 +19,13 @@ export default async function LoginPage() {
<div className={style.loginContainer}> <div className={style.loginContainer}>
<h1>Login</h1> <h1>Login</h1>
<form> <LoginForm />
<LabeledInput
type='email'
label='E-Mail'
placeholder='Enter your E-Mail'
/>
<LabeledInput
type='password'
label='Password'
placeholder='Enter your Password'
/>
</form>
<Login provider={''} providerDisplayName={''}></Login> <hr style={{ width: '100%' }} />
<hr style={{ width: 230 }} /> {process.env.AUTH_AUTHENTIK_ISSUER && (
<SSOLogin provider='authentik' providerDisplayName='SSO' />
<SSOLogin provider='authentik' providerDisplayName='SSO' /> )}
</div> </div>
); );
} }

View file

@ -6,6 +6,7 @@
border: 2px solid var(--color-100); border: 2px solid var(--color-100);
transition: background-color 0.3s ease; transition: background-color 0.3s ease;
height: 50px; height: 50px;
width: min(100%, 300px);
} }
.button:hover { .button:hover {

View file

@ -8,22 +8,17 @@ 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>
@ -35,9 +30,6 @@ 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>

View file

@ -6,7 +6,7 @@
.input { .input {
position: relative; position: relative;
overflow: visible; overflow: visible;
width: 250px; width: 100%;
} }
.input input { .input input {

View file

@ -1,11 +0,0 @@
import Button from '../button';
export default function Login() {
return (
<form>
<Button type='submit' mode='primary' width={250}>
Login
</Button>
</form>
);
}

View file

@ -0,0 +1,7 @@
.loginForm {
display: flex;
flex-direction: column;
gap: 1rem;
align-items: center;
justify-content: center;
}

View file

@ -0,0 +1,23 @@
import style from './login-form.module.css';
import Button from '../button';
import LabeledInput from '@/components/labeled-input';
export default function LoginForm() {
return (
<form className={style.loginForm}>
<LabeledInput
type='email'
label='E-Mail'
placeholder='Enter your E-Mail'
/>
<LabeledInput
type='password'
label='Password'
placeholder='Enter your Password'
/>
<Button type='submit' mode='primary'>
Login
</Button>
</form>
);
}

View file

@ -15,8 +15,15 @@ export default function SSOLogin({
'use server'; 'use server';
await signIn(provider); await signIn(provider);
}} }}
style={{
display: 'flex',
flexDirection: 'column',
gap: '1rem',
width: '100%',
alignItems: 'center',
}}
> >
<Button type='submit' mode='warning' icon={faOpenid} width={250}> <Button type='submit' mode='warning' icon={faOpenid}>
Login with {providerDisplayName} Login with {providerDisplayName}
</Button> </Button>
</form> </form>