Skip to content

Commit e2b538e

Browse files
committed
misc changes following review
1 parent d8a2637 commit e2b538e

File tree

12 files changed

+96
-475
lines changed

12 files changed

+96
-475
lines changed

docs/LICENSE

Lines changed: 0 additions & 394 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
body {
2+
--admonition-title-font-size: 0.9rem !important;
3+
--admonition-font-size: 0.9rem !important;
4+
}
5+
6+
.admonition-title {
7+
font-weight: bold !important;
8+
}

docs/source/_static/css/sphinx-design-overrides.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ body {
66
--sd-color-warning-text: var(--color-admonition-title--warning);
77
--sd-color-danger-text: var(--color-admonition-title--danger);
88
}
9+
10+
.sd-card-body {
11+
display: flex;
12+
flex-direction: column;
13+
align-items: stretch;
14+
}

docs/source/creating-interfaces/html-with-idom.rst

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,43 @@ HTML With IDOM
44
In a typical Python-base web application the resonsibility of defining the view along
55
with its backing data and logic are distributed between a client and server
66
respectively. With IDOM, both these tasks are centralized in a single place. This is
7-
done by allowing HTML interfaces to be constructed in Python. Let's consider the HTML
8-
sample below:
7+
done by allowing HTML interfaces to be constructed in Python. Take a look at the two
8+
code examples below. The one on the left shows how to make a basic title and todo list
9+
using standard HTML while the one of the right uses IDOM in Python:
910

10-
.. code-block:: html
11+
.. grid:: 2
12+
:margin: 0
13+
:padding: 0
1114

12-
<h1>My Todo List</h1>
13-
<ul>
14-
<li>Build a cool new app</li>
15-
<li>Share it with the world!</li>
16-
</ul>
15+
.. grid-item::
1716

18-
We can recreate the same thing with IDOM using functions attached to the
19-
:mod:`idom.html` module. These function share the same names as their corresponding HTML
20-
tags. For example, the `<h1/>` element above has a similarly named :func:`idom.html.h1`
21-
function. Given this we can write the following:
17+
.. code-block:: html
2218

23-
.. testcode::
19+
<h1>My Todo List</h1>
20+
<ul>
21+
<li>Build a cool new app</li>
22+
<li>Share it with the world!</li>
23+
</ul>
2424

25-
from idom import html
25+
.. grid-item::
2626

27-
html.h1("My Todo List")
28-
html.ul(
29-
html.li("Build a cool new app"),
30-
html.li("Share it with the world!"),
31-
)
27+
.. testcode::
28+
29+
from idom import html
3230

33-
That looks similar, but it's not very useful, we haven't captured the results from these
34-
function calls in a variable. To do this we need to wraps up layout above into a single
35-
:func:`idom.html.div` and assign it to a variable:
31+
html.h1("My Todo List")
32+
html.ul(
33+
html.li("Build a cool new app"),
34+
html.li("Share it with the world!"),
35+
)
36+
37+
What this shows is that you can recreate the same HTML layouts with IDOM using functions
38+
from the :mod:`idom.html` module. These function share the same names as their
39+
corresponding HTML tags. For example, the ``<h1/>`` element above has a similarly named
40+
:func:`~idom.html.h1` function. With that said, while the code above looks similar, it's
41+
not very useful because we haven't captured the results from these function calls in a
42+
variable. To do this we need to wraps up layout above into a single
43+
:func:`~idom.html.div` and assign it to a variable:
3644

3745
.. testcode::
3846

@@ -45,28 +53,31 @@ function calls in a variable. To do this we need to wraps up layout above into a
4553
)
4654

4755
Having done this we can inspect what is contained in our new ``layout`` variable. As it
48-
turns out, it holds a dictionary:
56+
turns out, it holds a dictionary. Printing it produces the following output:
4957

5058
.. testcode::
5159

52-
assert isinstance(layout, dict)
53-
54-
And if we print the contents with :mod:`pprint` it should look like:
55-
56-
.. testcode::
57-
58-
from pprint import pprint
59-
pprint(layout, sort_dicts=False)
60+
print(layout)
6061

6162
.. testoutput::
62-
63-
{'tagName': 'div',
64-
'children': [{'tagName': 'h1', 'children': ['My Todo List']},
65-
{'tagName': 'ul',
66-
'children': [{'tagName': 'li',
67-
'children': ['Build a cool new app']},
68-
{'tagName': 'li',
69-
'children': ['Share it with the world!']}]}]}
63+
:options: +NORMALIZE_WHITESPACE
64+
65+
{
66+
'tagName': 'div',
67+
'children': [
68+
{
69+
'tagName': 'h1',
70+
'children': ['My Todo List']
71+
},
72+
{
73+
'tagName': 'ul',
74+
'children': [
75+
{'tagName': 'li', 'children': ['Build a cool new app']},
76+
{'tagName': 'li', 'children': ['Share it with the world!']}
77+
]
78+
}
79+
]
80+
}
7081

7182
This may look complicated, but let's take a moment to consider what's going on here. We
7283
have a series of nested dictionaries that, in some way, represents the HTML structure

docs/source/creating-interfaces/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Creating Interfaces
1313
.. dropdown:: :octicon:`bookmark-fill;2em` What You'll Learn
1414
:color: info
1515
:animate: fade-in
16+
:open:
1617

1718
.. grid:: 2
1819

docs/source/credits-and-licenses.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Credits and Licenses
2+
====================
3+
4+
Much of this documentation was created with heavy influence from https://reactjs.org
5+
which uses the `Creative Commons Attribution 4.0 International
6+
<https://raw.githubusercontent.com/reactjs/reactjs.org/b2d5613b6ae20855ced7c83067b604034bebbb44/LICENSE-DOCS.md>`__
7+
license. While much of the content has been transformed in one way or another, we
8+
paraphrase or copy directly in places where React's behavior is mirroried by IDOM's.
9+
Additionally, the outline of the documentation closely mirror's React's documentation
10+
11+
12+
Source Code License
13+
-------------------
14+
15+
.. literalinclude:: ../../LICENSE
16+
:language: text

docs/source/getting-started/index.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Getting Started
1010
.. dropdown:: :octicon:`bookmark-fill;2em` What You'll Learn
1111
:color: info
1212
:animate: fade-in
13+
:open:
1314

1415
.. grid:: 2
1516

@@ -58,9 +59,10 @@ To check that everything is working you can run the sample application:
5859
5960
This should automatically open up a browser window to a page that looks like this:
6061

61-
.. interactive-widget:: sample_app
62-
:no-activate-button:
63-
:margin: 12
62+
.. card::
63+
64+
.. interactive-widget:: sample_app
65+
:no-activate-button:
6466

6567
If you get a ``RuntimeError`` similar to the following:
6668

docs/source/getting-started/running-idom.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,9 @@ run your application by setting the ``IDOM_DEBUG_MODE`` environment variable.
4343
$env:IDOM_DEBUG_MODE = "1"
4444
python my_idom_app.py
4545
46-
.. dropdown:: Leave debug mode off in production!
47-
:color: danger
48-
:animate: fade-in
46+
.. danger::
4947

50-
Turning on ``IDOM_DEBUG_MODE`` will:
51-
52-
- leak secrets
53-
- display error messages to your users
54-
- add extra checks that slow down your app
48+
Leave debug mode off in production!
5549

5650
Among other things, running in this mode:
5751

@@ -290,5 +284,9 @@ existing Python app:
290284
After running ``python main.py``, you should be able to navigate to
291285
``http://127.0.0.1:8000/index.html`` and see:
292286

293-
.. image:: _static/embed-idom-view/screenshot.png
287+
.. card::
288+
:text-align: center
289+
290+
.. image:: _static/embed-idom-view/screenshot.png
291+
:width: 500px
294292

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ IDOM
1818
understanding-idom/index
1919
developing-idom/index
2020
reference-material/index
21-
licenses
21+
credits-and-licenses
2222

2323
.. toctree::
2424
:hidden:

docs/source/licenses.rst

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

requirements/build-docs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ setuptools_scm
55
sphinx-copybutton ==0.3.0
66
sphinx-autobuild ==2020.9.1
77
sphinx-reredirects ==0.0.1
8-
sphinx-design ==0.0.12
8+
sphinx-design ==0.0.13
99
sphinx-resolve-py-references ==0.1.0

src/idom/sample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@component
1111
def App() -> VdomDict:
1212
return html.div(
13-
{"style": {"padding": "15px", "border": "1px solid grey"}},
13+
{"style": {"padding": "15px"}},
1414
html.h1("Sample Application"),
1515
html.p(
1616
"This is a basic application made with IDOM. Click ",

0 commit comments

Comments
 (0)