Fixup and rename Gauge color getter function types

Signed-off-by: James Turley <jamesturley@gocardless.com>
This commit is contained in:
James Turley
2021-11-10 15:13:03 +00:00
parent 2e641b622b
commit 1e3388a0f4
3 changed files with 10 additions and 10 deletions
@@ -15,7 +15,7 @@
*/
import { makeStyles, useTheme } from '@material-ui/core/styles';
import { BackstageTheme } from '@backstage/theme';
import { BackstagePalette, BackstageTheme } from '@backstage/theme';
import { Circle } from 'rc-progress';
import React from 'react';
@@ -52,17 +52,17 @@ export type GaugeProps = {
inverse?: boolean;
unit?: string;
max?: number;
getColor?: GetColor;
getColor?: GaugePropsGetColor;
};
type GetColorArgs = {
palette: BackstageTheme['palette'];
export type GaugePropsGetColorOptions = {
palette: BackstagePalette;
value: number;
inverse?: boolean;
max?: number;
};
export type GetColor = (args: GetColorArgs) => string;
export type GaugePropsGetColor = (args: GaugePropsGetColorOptions) => string;
const defaultGaugeProps = {
fractional: true,
@@ -71,7 +71,7 @@ const defaultGaugeProps = {
max: 100,
};
export const getProgressColor: GetColor = ({
export const getProgressColor: GaugePropsGetColor = ({
palette,
value,
inverse,
@@ -18,7 +18,7 @@ import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { InfoCard, InfoCardVariants } from '../../layout/InfoCard';
import { BottomLinkProps } from '../../layout/BottomLink';
import { Gauge, GetColor } from './Gauge';
import { Gauge, GaugePropsGetColor } from './Gauge';
type Props = {
title: string;
@@ -28,7 +28,7 @@ type Props = {
progress: number;
inverse?: boolean;
deepLink?: BottomLinkProps;
getColor?: GetColor;
getColor?: GaugePropsGetColor;
};
/** @public */
@@ -20,14 +20,14 @@ import Tooltip from '@material-ui/core/Tooltip';
// @ts-ignore
import { Line } from 'rc-progress';
import { BackstageTheme } from '@backstage/theme';
import { getProgressColor, GetColor } from './Gauge';
import { getProgressColor, GaugePropsGetColor } from './Gauge';
type Props = {
/**
* Progress value between 0.0 - 1.0.
*/
value: number;
getColor?: GetColor;
getColor?: GaugePropsGetColor;
};
export function LinearGauge(props: Props) {