2022-10-27 21:46:17 +02:00
|
|
|
import { FC, ReactNode } from 'react'
|
2022-04-24 23:12:11 +02:00
|
|
|
import styles from './AuthLayout.module.scss'
|
|
|
|
|
2022-10-27 21:46:17 +02:00
|
|
|
interface AuthLayoutProps {
|
|
|
|
children?: ReactNode
|
|
|
|
}
|
|
|
|
const AuthLayout: FC<AuthLayoutProps> = ({ children }) => (
|
2022-04-24 23:12:11 +02:00
|
|
|
<div className={`${styles.root} min-h-screen`}>
|
2022-10-27 21:46:17 +02:00
|
|
|
<aside className="flex items-center justify-center bg-pink-300">
|
2022-04-24 23:12:11 +02:00
|
|
|
<h1 className="text-4xl">Wishes</h1>
|
|
|
|
</aside>
|
2022-10-27 21:46:17 +02:00
|
|
|
<main className="flex flex-col items-center justify-center">
|
|
|
|
<div>{children}</div>
|
2022-04-24 23:12:11 +02:00
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
|
|
|
|
interface AuthFieldProps {
|
|
|
|
name: string
|
|
|
|
required?: boolean
|
|
|
|
type: 'text' | 'password'
|
2022-10-27 21:46:17 +02:00
|
|
|
children?: ReactNode
|
2022-04-24 23:12:11 +02:00
|
|
|
}
|
|
|
|
const AuthField: FC<AuthFieldProps> = (props) => {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<label
|
|
|
|
htmlFor={props.name}
|
2022-10-27 21:46:17 +02:00
|
|
|
className="mb-2 block text-sm font-bold text-gray-800"
|
2022-04-24 23:12:11 +02:00
|
|
|
>
|
|
|
|
{props.children}
|
|
|
|
</label>
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
name={props.name}
|
|
|
|
required
|
2022-10-27 21:46:17 +02:00
|
|
|
className="w-full appearance-none rounded border py-2 px-3 leading-tight text-gray-800"
|
2022-04-24 23:12:11 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
interface AuthPasswordProps {
|
|
|
|
name: string
|
|
|
|
required?: boolean
|
2022-10-27 21:46:17 +02:00
|
|
|
children?: ReactNode
|
2022-04-24 23:12:11 +02:00
|
|
|
}
|
|
|
|
export const AuthPassword: FC<AuthPasswordProps> = (props) => (
|
|
|
|
<AuthField {...props} type="password" />
|
|
|
|
)
|
|
|
|
|
|
|
|
interface AuthInputProps {
|
|
|
|
name: string
|
|
|
|
required?: boolean
|
2022-10-27 21:46:17 +02:00
|
|
|
children?: ReactNode
|
2022-04-24 23:12:11 +02:00
|
|
|
}
|
|
|
|
export const AuthInput: FC<AuthPasswordProps> = (props) => (
|
|
|
|
<AuthField {...props} type="text" />
|
|
|
|
)
|
|
|
|
|
|
|
|
export default AuthLayout
|