mars-v2-frontend/src/utils/healthIndicator.ts
Linkie Link fbb4207f93
Health indicator change preview (#410)
* fix: adjusted the AccountDetail width

* feat: added health indicator updates

* Update src/components/Account/AccountDetails.tsx

Co-authored-by: Yusuf Seyrek <yusufseyrek@users.noreply.github.com>

* fix: created a function for the back- and foregroundColors

* fix: updated tailwind conf

* fix: fixed the useHealthColorAndLabel function

---------

Co-authored-by: Yusuf Seyrek <yusufseyrek@users.noreply.github.com>
Co-authored-by: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com>
2023-09-01 11:04:40 +02:00

16 lines
504 B
TypeScript

export function getHealthIndicatorColors(
color: string,
updatedColor: string,
colorPrefix: 'fill' | 'text',
isUpdated: boolean,
isIncrease: boolean,
): [backgroundColor: string, foregroundColor: string] {
let backgroundColor = color
if (isUpdated && isIncrease) backgroundColor = updatedColor
if (isUpdated && !isIncrease) backgroundColor = `${colorPrefix}-grey`
const foreGroundColor = isIncrease ? `${colorPrefix}-grey` : updatedColor
return [backgroundColor, foreGroundColor]
}