Skip to content

Commit 2075a98

Browse files
refactor(calendar-web): move events array outside of preview
1 parent 14f8642 commit 2075a98

File tree

1 file changed

+51
-50
lines changed

1 file changed

+51
-50
lines changed

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

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,59 +16,60 @@ const localizer = dateFnsLocalizer({
1616
locales: {}
1717
});
1818

19+
const events = [
20+
{
21+
title: "Leave",
22+
allDay: true,
23+
start: new Date(new Date().setDate(new Date().getDate() - 15)),
24+
end: new Date(new Date().setDate(new Date().getDate() - 7)),
25+
guid: "",
26+
color: ""
27+
},
28+
{
29+
title: "Leave",
30+
allDay: true,
31+
start: new Date(new Date().setDate(new Date().getDate() - 9)),
32+
end: new Date(new Date().setDate(new Date().getDate() - 5)),
33+
guid: "",
34+
color: "green"
35+
},
36+
{
37+
title: "BD",
38+
allDay: true,
39+
start: new Date(),
40+
end: new Date(),
41+
guid: "",
42+
color: "red"
43+
},
44+
{
45+
title: "Bank Holiday",
46+
allDay: true,
47+
start: new Date(new Date().valueOf() + 6000 * 3600 * 24),
48+
end: new Date(new Date().valueOf() + 9000 * 3600 * 24),
49+
guid: "",
50+
color: "grey"
51+
},
52+
{
53+
title: "Bank Holiday",
54+
allDay: true,
55+
start: new Date(new Date().valueOf() + 4000 * 3600 * 24),
56+
end: new Date(new Date().valueOf() + 8000 * 3600 * 24),
57+
guid: "",
58+
color: "purple"
59+
},
60+
{
61+
title: "Leave",
62+
allDay: true,
63+
start: new Date(new Date().valueOf() + 10000 * 3600 * 24),
64+
end: new Date(new Date().valueOf() + 14000 * 3600 * 24),
65+
guid: "",
66+
color: ""
67+
}
68+
];
69+
1970
export function preview(props: CalendarPreviewProps): ReactElement {
2071
const { class: className } = props;
2172
const wrapperStyle = constructWrapperStyle(props as WrapperStyleProps);
22-
const events = [
23-
{
24-
title: "Leave",
25-
allDay: true,
26-
start: new Date(new Date().setDate(new Date().getDate() - 15)),
27-
end: new Date(new Date().setDate(new Date().getDate() - 7)),
28-
guid: "",
29-
color: ""
30-
},
31-
{
32-
title: "Leave",
33-
allDay: true,
34-
start: new Date(new Date().setDate(new Date().getDate() - 9)),
35-
end: new Date(new Date().setDate(new Date().getDate() - 5)),
36-
guid: "",
37-
color: "green"
38-
},
39-
{
40-
title: "BD",
41-
allDay: true,
42-
start: new Date(),
43-
end: new Date(),
44-
guid: "",
45-
color: "red"
46-
},
47-
{
48-
title: "Bank Holiday",
49-
allDay: true,
50-
start: new Date(new Date().valueOf() + 6000 * 3600 * 24),
51-
end: new Date(new Date().valueOf() + 9000 * 3600 * 24),
52-
guid: "",
53-
color: "grey"
54-
},
55-
{
56-
title: "Bank Holiday",
57-
allDay: true,
58-
start: new Date(new Date().valueOf() + 4000 * 3600 * 24),
59-
end: new Date(new Date().valueOf() + 8000 * 3600 * 24),
60-
guid: "",
61-
color: "purple"
62-
},
63-
{
64-
title: "Leave",
65-
allDay: true,
66-
start: new Date(new Date().valueOf() + 10000 * 3600 * 24),
67-
end: new Date(new Date().valueOf() + 14000 * 3600 * 24),
68-
guid: "",
69-
color: ""
70-
}
71-
];
7273

7374
return (
7475
<div className={classnames("widget-events-preview", "widget-calendar", className)} style={wrapperStyle}>

0 commit comments

Comments
 (0)