({ min, max, value, onStepClick, ...rest }: ProgressProps)
| 1414 | const PROGRESS_STEP_SPACING = 1; |
| 1415 | |
| 1416 | const Progress = ({ min, max, value, onStepClick, ...rest }: ProgressProps) => { |
| 1417 | const { colors } = useTheme<MaterializeTheme>(); |
| 1418 | const steps: boolean[] = []; |
| 1419 | |
| 1420 | for (let i = min; i < max; i++) { |
| 1421 | steps.push(i <= value); |
| 1422 | } |
| 1423 | |
| 1424 | return ( |
| 1425 | <HStack {...rest} spacing={PROGRESS_STEP_SPACING}> |
| 1426 | {steps.map((filled, idx) => { |
| 1427 | return ( |
| 1428 | <Box |
| 1429 | key={idx} |
| 1430 | flexGrow="1" |
| 1431 | height="1" |
| 1432 | borderRadius="2px" |
| 1433 | transition="all 0.2s" |
| 1434 | bgColor={filled ? colors.accent.purple : colors.background.tertiary} |
| 1435 | onClick={() => onStepClick(idx)} |
| 1436 | cursor={value !== idx ? "pointer" : "auto"} |
| 1437 | title={value !== idx ? `Jump to step ${idx + 1}` : ""} |
| 1438 | sx={{ |
| 1439 | _hover: { |
| 1440 | backgroundColor: colors.accent.purple, |
| 1441 | boxShadow: |
| 1442 | value !== idx |
| 1443 | ? `0px 0px 3px 1px ${colors.accent.purple}` |
| 1444 | : "none", |
| 1445 | }, |
| 1446 | }} |
| 1447 | /> |
| 1448 | ); |
| 1449 | })} |
| 1450 | </HStack> |
| 1451 | ); |
| 1452 | }; |
| 1453 | |
| 1454 | type TutorialProps = GridItemProps & { |
| 1455 | runCommand: (command: string) => void; |
no test coverage detected