UNPKG

@appbuckets/react-ui

Version:
27 lines (24 loc) 671 B
import * as React from 'react'; function useProgressIndicator(indicator, progress) { var indicatorValue = indicator && (typeof indicator === 'string' || indicator === true ? indicator === 'percent' ? ''.concat(progress.percentage, '%') : ''.concat(progress.rawValue, '/').concat(progress.rawMax) : indicator(progress.rawValue)); return React.useMemo( function () { if (!indicator) { return null; } return React.createElement( 'div', { className: 'indicator' }, indicatorValue ); }, [indicator, indicatorValue] ); } export { useProgressIndicator as default };