Skip to content

Commit 92c7ff8

Browse files
committed
prettier fixes
1 parent b433224 commit 92c7ff8

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ export const DEFAULT_SUMMARY_LABEL = 'Total';
66

77
export const FINAL_SUMMARY_GRAPH_KEY = 'final-summary-bar';
88

9-
export const FINAL_SUMMARY_X_LABEL_KEY = 'final-summary-x-point'
9+
export const FINAL_SUMMARY_X_LABEL_KEY = 'final-summary-x-point';

src/types/types.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { CSSProperties } from "react";
1+
import { CSSProperties } from 'react';
22

33
export type IWaterfallGraphProps = {
44
transactions: Array<ITransaction>;
55
barWidth?: number;
6-
showBridgeLines? : boolean;
6+
showBridgeLines?: boolean;
77
showYAxisScaleLines?: boolean;
88
yAxisPixelsPerUnit?: number;
99
showFinalSummary?: boolean;
@@ -43,9 +43,9 @@ export type IGetIntervalAndYPointsReturnType = {
4343

4444
export type ICalculateBarWidth = (graphWidth: number) => number;
4545

46-
export type IOnChartClick = (chartElement: IChartElement | { name: 'summary'}) => void;
46+
export type IOnChartClick = (chartElement: IChartElement) => void;
4747

4848
export enum chartTypes {
4949
transaction,
5050
summary
51-
}
51+
}

src/waterfall-chart/WaterFallChart.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { IWaterfallGraphProps } from '../types/types';
33
import { useWaterfallChart } from './utils';
44
import styles from './styles.module.scss';
55
import '../index.css';
6-
import { DEFAULT_BAR_WIDTH,
6+
import {
7+
DEFAULT_BAR_WIDTH,
78
DEFAULT_PIXELS_PER_Y_UNIT,
89
DEFAULT_SUMMARY_LABEL,
910
FINAL_SUMMARY_GRAPH_KEY,
@@ -40,7 +41,7 @@ const WaterFallChart: FC<IWaterfallGraphProps> = (props) => {
4041
const onWrapperDimensionsChange = (): void => {
4142
if (wrapperRef.current) {
4243
setWrapperHeight(wrapperRef?.current?.offsetHeight);
43-
if (!barWidth || barWidth <= 0 ) setBarWidthVal(calculateBarWidth(wrapperRef?.current?.offsetWidth));
44+
if (!barWidth || barWidth <= 0) setBarWidthVal(calculateBarWidth(wrapperRef?.current?.offsetWidth));
4445
}
4546
};
4647

@@ -53,26 +54,26 @@ const WaterFallChart: FC<IWaterfallGraphProps> = (props) => {
5354

5455
const renderSummaryBar = (): JSX.Element => {
5556
const value = Math.abs(chartElements[chartElements?.length - 1]?.cumulativeSum);
56-
const barHeight = Math.abs((value/ yAxisScale) * yAxisPixelsPerUnit);
57+
const barHeight = Math.abs((value / yAxisScale) * yAxisPixelsPerUnit);
5758
const chartElement = {
5859
name: summaryXLabel,
5960
value,
6061
yVal: yValueForZeroLine - (value / yAxisScale) * yAxisPixelsPerUnit,
6162
cumulativeSum: 0,
6263
barHeight: barHeight
63-
}
64+
};
6465

6566
return (
6667
<rect
6768
key={FINAL_SUMMARY_GRAPH_KEY}
6869
width={barWidthVal}
6970
height={chartElement?.barHeight}
7071
y={chartElement?.yVal}
71-
x={(2 * chartElements?.length + 1 ) * barWidthVal}
72+
x={(2 * chartElements?.length + 1) * barWidthVal}
7273
className={`${styles.graphBar} ${styles.summaryGraphBar}`}
7374
onClick={(): void => onChartClick && onChartClick(chartElement)}
7475
/>
75-
)
76+
);
7677
};
7778

7879
return (
@@ -105,10 +106,7 @@ const WaterFallChart: FC<IWaterfallGraphProps> = (props) => {
105106
style={chartElement?.value >= 0 ? positiveBarStyles : negativeBarStyles}
106107
onClick={(): void => onChartClick && onChartClick(chartElement)}
107108
/>
108-
{showBridgeLines
109-
&& (showFinalSummary
110-
||index !== chartElements?.length - 1)
111-
&& (
109+
{showBridgeLines && (showFinalSummary || index !== chartElements?.length - 1) && (
112110
<line
113111
key={chartElement?.name}
114112
className={styles.bridgeLine}

src/waterfall-chart/styles.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@
7474
top: 5px;
7575
text-align: center;
7676
}
77-
}
77+
}

0 commit comments

Comments
 (0)