Skip to content

Commit 873efc4

Browse files
committed
feat(custom-chart-web): remove containerprops from customchart
1 parent a76cac2 commit 873efc4

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

packages/shared/charts/src/utils/chartStyles.ts

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
11
import { CSSProperties } from "react";
2-
import { CustomChartContainerProps } from "../../../../pluggableWidgets/custom-chart-web/typings/CustomChartProps";
2+
3+
export type WidthUnitEnum = "pixels" | "percentage";
4+
export type HeightUnitEnum = "percentageOfWidth" | "pixels" | "percentageOfParent" | "percentageOfView";
5+
export type MinHeightUnitEnum = "none" | "pixels" | "percentageOfParent" | "percentageOfView";
6+
export type MaxHeightUnitEnum = "none" | "pixels" | "percentageOfParent" | "percentageOfView";
7+
export type OverflowYEnum = "auto" | "scroll" | "hidden";
8+
9+
export interface ChartContainerProps {
10+
widthUnit: WidthUnitEnum;
11+
width: number;
12+
heightUnit: HeightUnitEnum;
13+
height: number;
14+
minHeightUnit: MinHeightUnitEnum;
15+
minHeight: number;
16+
maxHeightUnit: MaxHeightUnitEnum;
17+
maxHeight: number;
18+
OverflowY: OverflowYEnum;
19+
}
320

421
function getHeightScale(height: number, heightUnit: "pixels" | "percentageOfParent" | "percentageOfView"): string {
522
return `${height}${heightUnit === "pixels" ? "px" : heightUnit === "percentageOfView" ? "vh" : "%"}`;
623
}
724

8-
export function constructWrapperStyle(props: CustomChartContainerProps): CSSProperties {
25+
export function constructWrapperStyle<T extends ChartContainerProps>(props: T): CSSProperties {
926
const { widthUnit, heightUnit, minHeightUnit, maxHeightUnit, width, height, minHeight, maxHeight, OverflowY } =
1027
props;
1128

0 commit comments

Comments
 (0)