Skip to content

Commit 030ce57

Browse files
refactor(calendar-web): update constructWrapperStyle to merge styles
1 parent 0809f6f commit 030ce57

File tree

1 file changed

+28
-4
lines changed
  • packages/pluggableWidgets/calendar-web/src/utils

1 file changed

+28
-4
lines changed

packages/pluggableWidgets/calendar-web/src/utils/utils.ts

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,33 @@ export function getHeightScale(
88
return `${height}${heightUnit === "pixels" ? "px" : heightUnit === "percentageOfView" ? "vh" : "%"}`;
99
}
1010

11-
export function constructWrapperStyle(props: CalendarContainerProps): CSSProperties {
12-
const { widthUnit, heightUnit, minHeightUnit, maxHeightUnit, width, height, minHeight, maxHeight, overflowY } =
13-
props;
11+
export type WrapperStyleProps = Pick<
12+
CalendarContainerProps,
13+
| "widthUnit"
14+
| "heightUnit"
15+
| "minHeightUnit"
16+
| "maxHeightUnit"
17+
| "width"
18+
| "height"
19+
| "minHeight"
20+
| "maxHeight"
21+
| "overflowY"
22+
| "style"
23+
>;
24+
25+
export function constructWrapperStyle(props: WrapperStyleProps): CSSProperties {
26+
const {
27+
widthUnit,
28+
heightUnit,
29+
minHeightUnit,
30+
maxHeightUnit,
31+
width,
32+
height,
33+
minHeight,
34+
maxHeight,
35+
overflowY,
36+
style
37+
} = props;
1438

1539
const wrapperStyle: Pick<CSSProperties, "width" | "height" | "minHeight" | "maxHeight" | "maxWidth" | "overflowY"> =
1640
{};
@@ -31,5 +55,5 @@ export function constructWrapperStyle(props: CalendarContainerProps): CSSPropert
3155
wrapperStyle.height = getHeightScale(height, heightUnit);
3256
}
3357

34-
return wrapperStyle;
58+
return { ...style, ...wrapperStyle };
3559
}

0 commit comments

Comments
 (0)