refactor: organized component folder structure
fix: scrolling in login page
This commit is contained in:
parent
138970f4c3
commit
a412d0710b
15 changed files with 31 additions and 31 deletions
20
src/components/buttons/icon-button.tsx
Normal file
20
src/components/buttons/icon-button.tsx
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { Button } from '@/components/ui/button';
|
||||
|
||||
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
|
||||
export function IconButton({
|
||||
icon,
|
||||
children,
|
||||
...props
|
||||
}: {
|
||||
icon: IconProp;
|
||||
children: React.ReactNode;
|
||||
} & React.ComponentProps<typeof Button>) {
|
||||
return (
|
||||
<Button type='button' variant='secondary' {...props}>
|
||||
<FontAwesomeIcon icon={icon} className='mr-2' />
|
||||
{children}
|
||||
</Button>
|
||||
);
|
||||
}
|
16
src/components/buttons/redirect-button.tsx
Normal file
16
src/components/buttons/redirect-button.tsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { Button } from '../ui/button';
|
||||
import Link from 'next/link';
|
||||
|
||||
export function RedirectButton({
|
||||
redirectUrl,
|
||||
buttonText,
|
||||
}: {
|
||||
redirectUrl: string;
|
||||
buttonText: string;
|
||||
}) {
|
||||
return (
|
||||
<Link href={redirectUrl}>
|
||||
<Button>{buttonText}</Button>
|
||||
</Link>
|
||||
);
|
||||
}
|
30
src/components/buttons/sso-login-button.tsx
Normal file
30
src/components/buttons/sso-login-button.tsx
Normal file
|
@ -0,0 +1,30 @@
|
|||
import { signIn } from '@/auth';
|
||||
import { IconButton } from '@/components/buttons/icon-button';
|
||||
import { faOpenid } from '@fortawesome/free-brands-svg-icons';
|
||||
|
||||
export default function SSOLogin({
|
||||
provider,
|
||||
providerDisplayName,
|
||||
}: {
|
||||
provider: string;
|
||||
providerDisplayName: string;
|
||||
}) {
|
||||
return (
|
||||
<form
|
||||
className='flex flex-col items-center w-full'
|
||||
action={async () => {
|
||||
'use server';
|
||||
await signIn(provider);
|
||||
}}
|
||||
>
|
||||
<IconButton
|
||||
className='w-full'
|
||||
type='submit'
|
||||
variant='secondary'
|
||||
icon={faOpenid}
|
||||
>
|
||||
Login with {providerDisplayName}
|
||||
</IconButton>
|
||||
</form>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue