wishlist-client/components/layout/authentication/AuthLayout.tsx
kjuulh 13e5d967ce
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
Fix missing children
2022-10-27 21:46:17 +02:00

62 lines
1.4 KiB
TypeScript

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