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

📔 Document SafetyButton

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

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)