import React from 'react'; import {RulerProgressBarStyle as S} from './styles/ruler-progress-bar.style'; import {IRulerProgressProps} from './ruler-progress-bar.types'; import {TooltipComponent} from '../..'; import InfoCircle from 'herein-icon/info-circle'; import {defaultIndicatorConfig} from './config'; export const RulerProgressBar: React.FC = ({ header, setting, amount, containerClassName, tooltipClassName, wrapperBox = true, isRtl = false, }) => { let achievementAmount; if (Number(amount) > 100) achievementAmount = 100; else if (Number(amount) < 0) achievementAmount = 0; else achievementAmount = Number(amount); return ( <> {header.title} {header.tooltip && ( )} {header.rightSection && ( {header.rightSection.title}:{' '} {header.rightSection.value} )} {achievementAmount > 0 ? ( ) : ( <> )} {(setting?.indicatorConfig || defaultIndicatorConfig).map( (val, index) => ( {typeof val.text === 'string' ? ( {val.text} ) : null} ), )} ); };