Skip to content

Commit 139bdb0

Browse files
committed
misc doc cleanup + under construction sections
1 parent ba312a5 commit 139bdb0

File tree

9 files changed

+80
-124
lines changed

9 files changed

+80
-124
lines changed
File renamed without changes.

docs/source/examples.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ You can find the following examples and more on binder |launch-binder|:
77
:local:
88
:depth: 1
99

10+
11+
Display Function
12+
----------------
13+
1014
Depending on how you plan to use these examples you'll need different
1115
boilerplate code.
1216

File renamed without changes.
File renamed without changes.

docs/source/index.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ Libraries for defining and controlling interactive webpages with Python
1010
.. toctree::
1111
:maxdepth: 1
1212

13-
install
14-
basics
15-
concepts
13+
installation
14+
getting-started
15+
javascript-modules
16+
core-concepts
17+
how-it-works
18+
specifications
19+
extra-features
1620
examples
17-
specs
18-
extras
1921
glossary
2022
api
2123

docs/source/install.rst

Lines changed: 0 additions & 119 deletions
This file was deleted.

docs/source/javascript-modules.rst

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
Javascript Modules
2+
==================
3+
4+
.. note::
5+
6+
This is recent feature of IDOM. If you have a problem following this tutorial
7+
`post an issue <https://github.com/rmorshea/idom/issues>`__.
8+
9+
While IDOM is a great tool for displaying HTML and respond to browser events with
10+
pure Python, there are other projects which already allow you to do this inside
11+
`Jupyter Notebooks <https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Basics.html>`__
12+
or in
13+
`webpages <https://blog.jupyter.org/and-voil%C3%A0-f6a2c08a4a93?gi=54b835a2fcce>`__.
14+
The real power of IDOM comes from its ability to seemlessly leverage the existing
15+
ecosystem of `React components <https://reactjs.org/docs/components-and-props.html>`__.
16+
So long as you can install a React library using `Snowpack <https://www.snowpack.dev/>`__
17+
you can use it in your IDOM layout. You can even define your own Javascript modules
18+
which use these third party Javascript packages.
19+
20+
21+
Installing React Components
22+
---------------------------
23+
24+
.. note::
25+
26+
- Be sure that you've installed `npm <https://www.npmjs.com/get-npm>`__.
27+
28+
- We're assuming the presence of a :ref:`Display Function` for our examples.
29+
30+
Once you've done this you can get started right away. In this example we'll be using a
31+
charting library for React called `Victory <https://formidable.com/open-source/victory/>`__.
32+
Installing it in IDOM is quite simple:
33+
34+
.. code-block::
35+
36+
import idom
37+
# this may take a minute to download and install
38+
victory = idom.Module(name="victory", install=True)
39+
40+
You can install a specific version using ``install="[email protected]`` or any other
41+
standard javascript dependency specifier. Alternatively, if you need to access a module
42+
in a subfolder of your desired Javascript package, you can provide ``name="path/to/module"``
43+
and ``install"my-package"``.
44+
45+
With that out of the way can import a component from Victory:
46+
47+
.. code-block::
48+
49+
VictoryBar = victory.Import("VictoryBar")
50+
51+
Using the ``VictoryBar`` chart component is as simple as displaying it:
52+
53+
.. code-block::
54+
55+
display(VictoryBar)
56+
57+
58+
Passing Props To Components
59+
---------------------------
60+
61+
Under construction...
62+
63+
64+
Defining Your Own Modules
65+
-------------------------
File renamed without changes.

docs/source/under-the-hood.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Under The Hood
2+
==============
3+
4+
Under construction...

0 commit comments

Comments
 (0)