UNPKG

ness

Version:

✪ No-effort static sites deployed to your AWS account.

57 lines (56 loc) 1.66 kB
import React from 'react'; export declare enum TaskState { Pending = 0, Success = 1, Failure = 2, Skipped = 3 } export declare type TaskProps = { /** * Text to be displayed while the action is running. */ readonly name: React.ReactElement | string; /** * Text to be displayed beside the name in gray. */ readonly note?: string; /** * The action to perform. If not action is provided, the task will await any children Tasks. */ readonly action: () => Promise<TaskState>; /** * A callback that's fired when the action is complete. */ readonly onComplete?: (state: TaskState) => void; /** * Text to be displayed on success. If this isn't specified, `text` will remain unchanged. */ readonly success?: React.ReactElement | string; /** * Text to be displayed on failure. If this isn't specified, `text` will remain unchanged. */ readonly failure?: React.ReactElement | string; /** * Text to be displayed when the task is skipped. If this isn't specified, `text` will remain unchanged. */ readonly skipped?: React.ReactElement | string; /** * True if the task should remain visible after completion. * * @default true */ readonly persist?: boolean; /** * Minimum duration in miliseconds. * * @default 750 */ readonly minimumDuration?: number; /** * Color of the loading spinner. Any chalk supported colors are valid. * * @default 'green' */ readonly spinnerColor?: string; }; export declare const Task: React.FunctionComponent<TaskProps>;