Skip to content

Commit 6638883

Browse files
refactor(calendar-web): rename utils to style-utils
1 parent 5418364 commit 6638883

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

packages/pluggableWidgets/calendar-web/src/Calendar.editorPreview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Calendar, dateFnsLocalizer } from "react-big-calendar";
55
import { CalendarPreviewProps } from "../typings/CalendarProps";
66
import { CustomToolbar } from "./components/Toolbar";
77
import "react-big-calendar/lib/css/react-big-calendar.css";
8-
import { constructWrapperStyle, WrapperStyleProps } from "./utils/utils";
8+
import { constructWrapperStyle, WrapperStyleProps } from "./utils/style-utils";
99
import { eventPropGetter } from "./utils/calendar-utils";
1010

1111
const localizer = dateFnsLocalizer({
@@ -17,7 +17,7 @@ const localizer = dateFnsLocalizer({
1717
});
1818

1919
export function preview(props: CalendarPreviewProps): ReactElement {
20-
const className = props.class;
20+
const { class: className } = props;
2121
const wrapperStyle = constructWrapperStyle(props as WrapperStyleProps);
2222
const events = [
2323
{

packages/pluggableWidgets/calendar-web/src/Calendar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import classnames from "classnames";
22
import { ReactElement, createElement } from "react";
33
import { DnDCalendar, extractCalendarProps } from "./utils/calendar-utils";
44
import { CalendarContainerProps } from "../typings/CalendarProps";
5-
import { constructWrapperStyle } from "./utils/utils";
5+
import { constructWrapperStyle } from "./utils/style-utils";
66
import "./ui/Calendar.scss";
77

88
export default function MxCalendar(props: CalendarContainerProps): ReactElement {

packages/pluggableWidgets/calendar-web/src/utils/utils.ts renamed to packages/pluggableWidgets/calendar-web/src/utils/style-utils.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { CSSProperties } from "react";
22
import { CalendarContainerProps } from "../../typings/CalendarProps";
33

4-
export function getHeightScale(
5-
height: number,
6-
heightUnit: "pixels" | "percentageOfParent" | "percentageOfView"
7-
): string {
4+
function getHeightScale(height: number, heightUnit: "pixels" | "percentageOfParent" | "percentageOfView"): string {
85
return `${height}${heightUnit === "pixels" ? "px" : heightUnit === "percentageOfView" ? "vh" : "%"}`;
96
}
107

@@ -36,8 +33,7 @@ export function constructWrapperStyle(props: WrapperStyleProps): CSSProperties {
3633
style
3734
} = props;
3835

39-
const wrapperStyle: Pick<CSSProperties, "width" | "height" | "minHeight" | "maxHeight" | "maxWidth" | "overflowY"> =
40-
{};
36+
const wrapperStyle: Pick<CSSProperties, "width" | "height" | "minHeight" | "maxHeight" | "overflowY"> = {};
4137

4238
wrapperStyle.width = `${width}${widthUnit === "pixels" ? "px" : "%"}`;
4339
if (heightUnit === "percentageOfWidth") {

0 commit comments

Comments
 (0)