Skip to content

Commit 16b8147

Browse files
committed
update mui example
1 parent c217299 commit 16b8147

File tree

5 files changed

+31
-35
lines changed

5 files changed

+31
-35
lines changed

docs/source/architectural-patterns.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ If you're thinking critically about IDOM's use of a virtual DOM, you may have th
200200

201201
And yes, while the performance of IDOM is sufficient for most use cases, there are
202202
inevitably scenarios where this could be an issue. Thankfully though, just like its
203-
peers, IDOM makes it possible to seemlesly integrate :ref:`Custom Javascript Components`.
204-
They can be custom built for your use case, or you can just leverage the existing
205-
Javascript ecosystem without any extra work:
203+
peers, IDOM makes it possible to seemlesly integrate :ref:`Javascript Components`. They
204+
can be :ref:`custom built <Custom Javascript Components>` for your use case, or you can
205+
just leverage the existing Javascript ecosystem
206+
:ref:`without any extra work <Dynamically Loaded Components>`:
206207

207-
.. example:: material_ui_slider
208+
.. example:: material_ui_switch

docs/source/examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Material UI Slider
7272

7373
Move the slider and see the event information update 👇
7474

75-
.. example:: material_ui_slider
75+
.. example:: material_ui_switch
7676

7777

7878
.. Links

docs/source/examples/material_ui_slider.py

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import idom
2+
3+
4+
mui = idom.web.module_from_template("react", "@material-ui/core@^5.0", fallback="⌛")
5+
Switch = idom.web.export(mui, "Switch")
6+
7+
8+
@idom.component
9+
def DayNightSwitch():
10+
checked, set_checked = idom.hooks.use_state(False)
11+
12+
return idom.html.div(
13+
Switch(
14+
{
15+
"checked": checked,
16+
"onChange": lambda event, checked: set_checked(checked),
17+
}
18+
),
19+
"🌞" if checked else "🌚",
20+
)
21+
22+
23+
idom.run(DayNightSwitch)

docs/source/javascript-components.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _Javascript Component:
2+
13
Javascript Components
24
=====================
35

0 commit comments

Comments
 (0)