1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 14:54:22 +00:00

📔 Document SafetyButton

This commit is contained in:
Steffo 2021-10-15 04:19:15 +02:00 committed by Stefano Pigozzi
parent ac50a1d530
commit a06acf6bfb

View file

@ -5,11 +5,19 @@ import * as React from "react"
import Style from "./SafetyButton.module.css"
/**
* Props of the {@link SafetyButton}.
*/
export interface SafetyButtonProps extends ButtonProps {
timeout: number,
}
/**
* {@link Button} which locks for a certain `timeout` and asks for confirmation before firing the `onClick` event.
*
* @constructor
*/
export function SafetyButton({timeout = 3, onClick, children, disabled, className, bluelibClassNames, ...props}: SafetyButtonProps): JSX.Element {
const [timerStarted, setTimerStarted] = React.useState<boolean>(false)
const [timerElapsed, setTimerElapsed] = React.useState<boolean>(false)