Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update Scatterplot component and alphabetize new component props #382

Merged
merged 12 commits into from
Mar 21, 2024
Merged
14 changes: 7 additions & 7 deletions src/components/AreaChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,22 @@ export const AreaChart: React.FC<AreaChartProps> = (
inProps: AreaChartProps,
): React.ReactElement<AreaChartProps> => {
const {
areaChartProps,
areaKeys,
areaProps,
children,
colors = [],
areaProps,
areaChartProps,
responsiveContainerProps,
tooltipProps,
data,
height,
legendProps,
width,
responsiveContainerProps,
showLegend = false,
areaKeys,
tooltipProps,
width,
xAxisProps,
yAxisProps,
xLabel,
xLabelProps,
yAxisProps,
yLabel,
yLabelProps,
yReferenceValue,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ export type MapProps = MapGLProps & {
| GeoJSON.FeatureCollection<GeoJSON.Geometry>
| string
| undefined;
height: number | string;
initialBoundsPosition?: InitialBoundsPositionProps;
layers?: Array<React.ReactElement<LayerProps>>;
layerProps?: LayerProps;
mapboxAccessToken: string;
navigationControlProps?: NavigationControlProps;
onMapClick?: (event: MapLayerMouseEvent, mapRef: MapRef | null) => void;
height: number | string;
width: number | string;
// eslint-disable-next-line react/boolean-prop-naming
preserveDrawingBuffer?: boolean;
setHoverInfo?: (value: FeatureHoverProps | undefined) => void;
sourceId?: string;
sourceProps?: SourceProps;
width: number | string;
};

/**
Expand Down
10 changes: 5 additions & 5 deletions src/components/OverlappedBarChart/OverlappedLabel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ export type OverlappedLabelProps = LabelProps & {

export const OverlappedLabel: React.FC<OverlappedLabelProps> = ({
color,
data,
height,
index,
isOutsideBar,
label,
outsideBarDataKey,
labelColor,
outsideBarDataKey,
value,
valueColor,
width,
x,
y,
data,
isOutsideBar,
height,
index,
}: OverlappedLabelProps): React.ReactElement<OverlappedLabelProps> => {
const { palette, spacing } = useTheme();

Expand Down
4 changes: 2 additions & 2 deletions src/components/OverlappedBarChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export interface OverlappedBarDataProps {
}

export interface OverlappedBarChartProps {
barChartProps?: Omit<BarChartProps, 'data'>;
barKeys: string[];
barProps?: Omit<BarProps, 'dataKey' | 'ref'>;
barChartProps?: Omit<BarChartProps, 'data'>;
children?: React.ReactElement<unknown>;
colors?: string[];
data: Array<OverlappedBarDataProps>;
Expand All @@ -50,9 +50,9 @@ export const OverlappedBarChart: React.FC<OverlappedBarChartProps> = (
inProps: OverlappedBarChartProps,
): React.ReactElement<OverlappedBarChartProps> => {
const {
barChartProps,
barKeys,
barProps,
barChartProps,
children,
colors = [],
data,
Expand Down
6 changes: 3 additions & 3 deletions src/components/PieChart/InnerPieComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import { PolarViewBox } from 'recharts/types/util/types';
import { HighlightComponentType, PieDataProps } from '../types';

interface InnerPieComponentProps extends LabelProps {
HighlightComponent: HighlightComponentType;
payload: PieDataProps;
pieTotalValue: number;
HighlightComponent: HighlightComponentType;
}

const InnerPieComponent: React.FC<InnerPieComponentProps> = ({
viewBox: wrongTypeViewBox,
HighlightComponent,
payload,
pieTotalValue,
HighlightComponent,
viewBox: wrongTypeViewBox,
}) => {
if (!wrongTypeViewBox) {
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/components/PieChart/PieLegend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export const PieLegend: React.FC<PieLegendProps> = (
chartHeight,
chartWidth,
formatValue,
onMouseEnter,
onMouseLeave,
payload,
pieTotalValue,
showAsSquare,
onMouseEnter,
onMouseLeave,
} = props;

const handleMouseEnter = (
Expand Down
4 changes: 2 additions & 2 deletions src/components/PieChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface PieChartProps {
CustomLegendIcon?: CustomLegendComponentType;
data: Array<TypesPieDataProps>;
height?: number;
HighlightComponent?: HighlightComponentType;
legendProps?: LegendProps;
pieChartProps?: CategoricalChartProps;
pieProps?: Partial<PieProps>;
Expand All @@ -65,7 +66,6 @@ export interface PieChartProps {
tooltipProps?: TooltipProps<ValueType, NameType>;
variant?: VariantType;
width?: number | string;
HighlightComponent?: HighlightComponentType;
}

export const DEFAULT_PIE_GAP_ANGLE = 1;
Expand All @@ -83,6 +83,7 @@ export const PieChart: React.FC<PieChartProps> = (
CustomLegendIcon,
data,
height,
HighlightComponent,
legendProps,
pieChartProps,
pieProps,
Expand All @@ -91,7 +92,6 @@ export const PieChart: React.FC<PieChartProps> = (
tooltipProps,
variant,
width,
HighlightComponent,
} = useThemeProps({ name: DLS_COMPONENT_NAMES.PIE_CHART, props: inProps });

const { palette, spacing, typography } = useTheme();
Expand Down
6 changes: 3 additions & 3 deletions src/components/SCFMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ export interface SCFMapProps {
mapboxAccessToken: string;
mapPopupProps?: Omit<MapPopupProps, 'popupProps'>;
mapProps?: Omit<Partial<MapProps>, 'mapboxAccessToken'>;
onHoverInfo?: FeatureHoverProps;
processDataFn?: (
featureCollection: GeoJSON.FeatureCollection<GeoJSON.Geometry>,
data: Array<IMapDataProps>,
) => GeoJSON.FeatureCollection<GeoJSON.Geometry>;
onHoverInfo?: FeatureHoverProps;
selectedSCF?: Array<string>;
setOnHoverInfo?: (newHoverInfo: FeatureHoverProps | undefined) => void;
tooltipElement?: React.ReactElement;
Expand All @@ -49,10 +49,10 @@ export interface SCFMapProps {
export const SCFMap: React.FC<SCFMapProps> = ({
data,
geoJSONPath,
onHoverInfo,
mapboxAccessToken,
mapProps,
mapPopupProps,
mapProps,
onHoverInfo,
processDataFn,
selectedSCF,
setOnHoverInfo,
Expand Down
6 changes: 3 additions & 3 deletions src/components/ScatterPlot/CustomTooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import {
import { IGroupDataPoint } from '../types';

type ICustomTooltipProps = {
isBlockingOnHovers: boolean;
CustomTooltipContent?: React.ElementType;
isBlockingOnHovers: boolean;
} & TooltipProps<ValueType, NameType>;

export const CustomTooltip: React.FC<ICustomTooltipProps> = ({
payload,
isBlockingOnHovers,
CustomTooltipContent,
isBlockingOnHovers,
payload,
}): React.ReactElement<TooltipProps<ValueType, NameType>> | null => {
const data = payload && (get(payload[0], 'payload') as IGroupDataPoint);
const members = data?.members;
Expand Down
10 changes: 5 additions & 5 deletions src/components/ScatterPlot/CustomizedCell/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ const OPACITY_NOT_HIGHLIGHTED = 0.2;

export type CustomizedScatterCellProps = CellProps & {
color?: string;
selectedPoint?: ScatterPlotData;
groupSize?: number;
members?: IGroupDataPoint[];
label?: string;
members?: IGroupDataPoint[];
selectedPoint?: ScatterPlotData;
};

const CustomizedCell: React.FC<CustomizedScatterCellProps> = ({
color,
cx,
cy,
groupSize,
height,
width,
selectedPoint,
label,
groupSize,
members,
selectedPoint,
width,
}) => {
const { palette } = useTheme();

Expand Down
8 changes: 4 additions & 4 deletions src/components/ScatterPlot/CustomizedLabel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { ScatterPlotData } from '~/types';
export type CustomizedLabelProps = LabelProps & {
fontSize?: number;
fontWeight?: number;
isBlockingOnHovers?: boolean;
selectedPoint?: ScatterPlotData;
shouldHideLabel?: Record<string, boolean>;
isBlockingOnHovers?: boolean;
};

export function calculateLabelWidth(label: string): number {
Expand All @@ -32,12 +32,12 @@ export const CustomizedLabel: React.FC<CustomizedLabelProps> = ({
fill,
fontSize,
fontWeight,
isBlockingOnHovers,
selectedPoint,
shouldHideLabel = {},
value,
x,
y,
selectedPoint,
shouldHideLabel = {},
isBlockingOnHovers,
}): React.ReactElement<CustomizedLabelProps> | null => {
let opacity = 1;
const isThisSelectedPoint =
Expand Down
4 changes: 2 additions & 2 deletions src/components/ScatterPlot/RankSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export interface RankSummaryProps {
idSubstring?: string;
selectedPoint?: ScatterPlotData;
setSelectedPoint?: (data: ScatterPlotData | undefined) => void;
showSummary?: boolean;
setShowSummary?: (value: boolean) => void;
showSummary?: boolean;
tableContainerProps?: TableContainerProps;
}

Expand All @@ -50,8 +50,8 @@ export const RankSummary: React.FC<RankSummaryProps> = ({
idSubstring,
selectedPoint,
setSelectedPoint,
showSummary = true,
setShowSummary,
showSummary = true,
tableContainerProps,
}: RankSummaryProps): JSX.Element => {
const ref = React.useRef<HTMLDivElement>(null);
Expand Down
Loading
Loading