Skip to content

Commit ffe179f

Browse files
committed
update lemcal component
1 parent a470314 commit ffe179f

File tree

1 file changed

+49
-7
lines changed

1 file changed

+49
-7
lines changed

reflex_ui/blocks/lemcal.py

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,28 @@
22

33
import reflex as rx
44

5+
import reflex_ui as ui
56

6-
def lemcal_calendar(**props) -> rx.Component:
7-
"""Return a Lemcal booking calendar container element."""
8-
return rx.el.div(
9-
class_name="lemcal-embed-booking-calendar",
10-
data_user="usr_8tiwtJ8nEJaFj2qH9",
11-
data_meeting_type="met_EHtPvmZoKE4SFk4kZ",
12-
**props,
7+
8+
@rx.memo
9+
def lemcal_booking_calendar():
10+
"""Return the Lemcal booking calendar."""
11+
return rx.fragment(
12+
rx.el.div(
13+
class_name="lemcal-embed-booking-calendar h-[calc(100dvh-4rem)] overflow-y-auto w-auto",
14+
custom_attrs={
15+
"data-user": "usr_8tiwtJ8nEJaFj2qH9",
16+
"data-meeting-type": "met_EHtPvmZoKE4SFk4kZ",
17+
},
18+
on_mount=rx.call_script(
19+
"""
20+
if (window.lemcal && window.lemcal.refresh) {
21+
window.lemcal.refresh();
22+
}
23+
"""
24+
),
25+
),
26+
lemcal_script(),
1327
)
1428

1529

@@ -20,3 +34,31 @@ def lemcal_script(**props) -> rx.Component:
2034
defer=True,
2135
**props,
2236
)
37+
38+
39+
def lemcal_dialog(trigger: rx.Component, **props) -> rx.Component:
40+
"""Return a Lemcal dialog container element."""
41+
class_name = ui.cn("w-auto", props.pop("class_name", ""))
42+
return ui.dialog.root(
43+
ui.dialog.trigger(trigger),
44+
ui.dialog.portal(
45+
ui.dialog.backdrop(),
46+
ui.dialog.popup(
47+
rx.el.div(
48+
ui.dialog.close(
49+
render_=ui.button(
50+
ui.hi("Cancel01Icon"),
51+
variant="secondary",
52+
size="icon-lg",
53+
class_name="text-secondary-12 absolute top-4 right-4 z-10",
54+
),
55+
),
56+
lemcal_booking_calendar(),
57+
class_name="relative isolate overflow-hidden",
58+
),
59+
class_name="h-[calc(100dvh-4rem)] w-auto mt-1 overflow-hidden",
60+
),
61+
),
62+
class_name=class_name,
63+
**props,
64+
)

0 commit comments

Comments
 (0)