UNPKG

@kiwicom/orbit-components

Version:

Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com's products.

45 lines 1.45 kB
import * as React from "react"; import cx from "clsx"; import useTheme from "../../../hooks/useTheme"; export const getStatusColor = (theme, type) => { const colors = { success: theme.orbit.textSuccessForeground, warning: theme.orbit.textWarningForeground, critical: theme.orbit.textCriticalForeground, info: theme.orbit.textInfoForeground }; return type ? colors[type] : theme.orbit.paletteCloudNormalHover; }; const ProgressLine = ({ desktop, status, nextStatus, last, prevStatus }) => { const theme = useTheme(); const getBorderStyle = () => { if (desktop) { if (status && !nextStatus && !last) { return { borderImageSlice: 1, borderImageSource: `linear-gradient(to right, ${getStatusColor(theme, prevStatus)}, ${getStatusColor(theme, status)})` }; } } if (status && !nextStatus && !last) { return { borderImageSlice: 1, borderImageSource: `linear-gradient(to bottom, ${getStatusColor(theme, prevStatus)}, ${getStatusColor(theme, status)})` }; } return { borderColor: getStatusColor(theme, status) }; }; return /*#__PURE__*/React.createElement("span", { className: cx("border", status ? "border-solid" : "border-dashed", desktop ? "w-1/2" : "absolute top-[15px] h-[calc(100%+theme(spacing.50))] ltr:left-[11px] rtl:right-[11px]"), style: getBorderStyle() }); }; export default ProgressLine;