@material-ui/core#StepIconProps TypeScript Examples
The following examples show how to use
@material-ui/core#StepIconProps.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskPage.tsx From backstage with Apache License 2.0 | 6 votes |
function TaskStepIconComponent(props: StepIconProps) {
const classes = useStepIconStyles();
const { active, completed, error } = props;
const getMiddle = () => {
if (active) {
return <CircularProgress size="24px" />;
}
if (completed) {
return <Check />;
}
if (error) {
return <Cancel />;
}
return <FiberManualRecordIcon />;
};
return (
<div
className={classNames(classes.root, {
[classes.completed]: completed,
[classes.error]: error,
})}
>
{getMiddle()}
</div>
);
}
Example #2
Source File: TaskPage.tsx From backstage with Apache License 2.0 | 5 votes |
TaskStatusStepper = memo(
(props: {
steps: TaskStep[];
currentStepId: string | undefined;
onUserStepChange: (id: string) => void;
classes?: {
root?: string;
};
}) => {
const { steps, currentStepId, onUserStepChange } = props;
const classes = useStyles(props);
return (
<div className={classes.root}>
<Stepper
activeStep={steps.findIndex(s => s.id === currentStepId)}
orientation="vertical"
nonLinear
>
{steps.map((step, index) => {
const isCompleted = step.status === 'completed';
const isFailed = step.status === 'failed';
const isActive = step.status === 'processing';
const isSkipped = step.status === 'skipped';
return (
<Step key={String(index)} expanded>
<StepButton onClick={() => onUserStepChange(step.id)}>
<StepLabel
StepIconProps={{
completed: isCompleted,
error: isFailed,
active: isActive,
}}
StepIconComponent={TaskStepIconComponent}
className={classes.stepWrapper}
>
<div className={classes.labelWrapper}>
<Typography variant="subtitle2">{step.name}</Typography>
{isSkipped ? (
<Typography variant="caption">Skipped</Typography>
) : (
<StepTimeTicker step={step} />
)}
</div>
</StepLabel>
</StepButton>
</Step>
);
})}
</Stepper>
</div>
);
},
)