mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-09-11 22:06:29 +02:00
Improve registration form
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user