@appbuckets/react-ui
Version:
Just Another React UI Framework
27 lines (24 loc) • 671 B
JavaScript
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 };