UNPKG

@shopify/cli-kit

Version:

A set of utilities, interfaces, and models that are common across all the platform features

21 lines 998 B
import { TextAnimation } from './TextAnimation.js'; import useLayout from '../hooks/use-layout.js'; import { shouldDisplayColors } from '../../../../public/node/output.js'; import React from 'react'; import { Box, Text } from 'ink'; const loadingBarChar = '▀'; const hillString = '▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁'; const LoadingBar = ({ title, noColor, noProgressBar }) => { const { twoThirds } = useLayout(); let loadingBar = new Array(twoThirds).fill(loadingBarChar).join(''); if (noColor ?? !shouldDisplayColors()) { loadingBar = hillString.repeat(Math.ceil(twoThirds / hillString.length)); } return (React.createElement(Box, { flexDirection: "column" }, !noProgressBar && React.createElement(TextAnimation, { text: loadingBar, maxWidth: twoThirds }), React.createElement(Text, null, title, " ..."))); }; export { LoadingBar }; //# sourceMappingURL=LoadingBar.js.map