Skip to content

Commit 90d891e

Browse files
committed
small fixes and improvements to examples
1 parent 343f059 commit 90d891e

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

pyscript.core/test/ui/demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def create_component_details(component_label, component):
4545
"""
4646
# Get the example from the examples catalog
4747
example = component["instance"]
48-
details = example.__doc__ or f"Details missing for component {component_label}"
48+
details = getattr(example, '__doc__', '') or f"Details missing for component {component_label}"
4949

5050
return div(
5151
[

pyscript.core/test/ui/examples.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def toggle_dialog():
8282
]:
8383
inputs_div.append(input_(type=input_type, style={"display": "block"}))
8484
inputs_code.append(f"input_(type='{input_type}')")
85-
inputs_code = "\n".join(inputs_code)
85+
8686

8787
headers_div = div()
8888
headers_code = []
@@ -91,6 +91,17 @@ def toggle_dialog():
9191
headers_code.append(f'{header.tag}("{header.tag.upper()} header")')
9292
headers_code = "\n".join(headers_code)
9393

94+
rich_input = input_(type='text', name='some name',
95+
autofocus=True, pattern="\w{3,16}",
96+
placeholder='add text with > 3 chars', required=True, size='20'
97+
)
98+
inputs_div.append(rich_input)
99+
inputs_code.append("# You can create inputs with more options like")
100+
inputs_code.append("# this by passing properties as kwargs")
101+
inputs_code.append(
102+
"input_(type='text', name='some name', autofocus=True, pattern='\\w{3,16}', placeholder='add text with > 3 chars', required=True, size='20')"
103+
)
104+
inputs_code = "\n".join(inputs_code)
94105

95106
MARKDOWN_EXAMPLE = """# This is a header
96107

pyscript.core/test/ui/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
body {
2626
font-family: -apple-system, "system-ui", "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"
2727
}
28+
29+
input:invalid {
30+
background-color: lightpink;
31+
}
32+
2833
</style>
2934
</head>
3035

0 commit comments

Comments
 (0)