Improve registration form

This commit is contained in:
pikiou
2022-04-08 16:17:35 +02:00
parent 7fc3ec08ba
commit 1936cd34a3
11 changed files with 780 additions and 238 deletions

View File

@@ -1,24 +1,31 @@
import { FC, ReactNode } from "react"
import { toastError } from "../../../store/utils"
import styles from "./styles.module.scss"
type Props = {
type?: "grey"
disabled?: boolean
children: ReactNode
onClick?: () => void
}
const FormButton: FC<Props> = ({ type, children, onClick }): JSX.Element => (
<button
type="button"
className={type === "grey" ? styles.greyButton : styles.button}
onClick={onClick}
>
{children}
</button>
)
const FormButton: FC<Props> = ({ type, disabled, children, onClick }): JSX.Element => {
const onDisabledClick = () => toastError("Bouton désactivé")
return (
<button
type="button"
className={type === "grey" || disabled ? styles.greyButton : styles.button}
onClick={disabled ? onDisabledClick : onClick}
>
{children}
</button>
)
}
FormButton.defaultProps = {
type: undefined,
disabled: false,
onClick: undefined,
}