Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | import { TickIcon } from "@assets/icons";
import { Text } from "@common/Text";
import { LinearProgress, Stack } from "@mui/material";
import { palette } from "@palette";
import { WarningIcon } from "@phosphor-icons/react";
import { checkPortals } from "@utils/routing";
const ProgressIcon = ({
value,
isActive,
svgProps,
isIncomplete,
}: {
value: number;
isActive: boolean;
svgProps?: { width?: number; height?: number };
isIncomplete: boolean;
}) => {
const { isMerchantPortal } = checkPortals();
if (isMerchantPortal) {
if (isIncomplete) {
return <WarningIcon color={palette.warning.text} size={14} />; // TODO: fix warning icon alignment
} else {
return (
<TickIcon
stroke={isActive ? palette.neutral.black : palette.neutral[70]}
width={svgProps?.width}
height={svgProps?.height}
/>
);
}
} else if (value === 100) {
return (
<TickIcon
stroke={isActive ? palette.neutral.black : palette.neutral[70]}
width={svgProps?.width}
height={svgProps?.height}
/>
);
}
return null;
};
const KotoLinearProgress = ({
LinearProgressProps,
svgProps,
isActive,
hasDescription,
isIncomplete,
...rest
}: any) => {
return (
<Stack flex={1} justifyContent="flex-start" width="100%">
{rest.title && (
<Text
mb={1}
textAlign="left"
color={isActive ? palette.neutral.black : palette.neutral[70]}
>
{rest.title}
</Text>
)}
<LinearProgress
variant="determinate"
{...rest}
sx={{
borderRadius: "90px",
backgroundColor: palette.neutral[30],
height: "2px",
".MuiLinearProgress-bar": {
backgroundColor: "neutral.black",
...(!isActive && { opacity: ".2" }),
},
...rest.sx,
}}
data-testid="stepper-linear-progress"
/>
{hasDescription && (
<Stack direction="row" gap={0.5} alignItems="baseline">
<ProgressIcon
value={rest.value}
isActive={isActive}
svgProps={svgProps}
isIncomplete={isIncomplete}
/>
<Text
data-testid={`Tab-label-${rest.label}`}
mt={1}
textAlign="left"
color={isActive ? palette.neutral.black : palette.neutral[70]}
{...LinearProgressProps}
>
{rest.label}
</Text>
</Stack>
)}
</Stack>
);
};
export default KotoLinearProgress;
|