Skip to content

Commit

Permalink
fix interactive demo
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosabadia committed Jul 26, 2024
1 parent e9c77f2 commit ec7685a
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions pcweb/pages/docs/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,32 @@ def generate_props(src, component, comp):
padding_left = "1em"

prop_dict = {}

is_interactive = True
if not rx.utils.types._issubclass(
component, (RadixThemesComponent, RadixPrimitiveComponent)
) or component.__name__ in [
"Theme",
"ThemePanel",
"DrawerRoot",
"DrawerTrigger",
"DrawerOverlay",
"DrawerPortal",
"DrawerContent",
"DrawerClose",
]:
is_interactive = False

body = rx.table.body(
*[
rx.table.row(
*prop_docs(prop, prop_dict, component, is_interactive), align="center"
)
for prop in src.get_props()
if not prop.name.startswith("on_") # ignore event trigger props
]
)

try:
if f"{component.__name__}" in comp.metadata:
comp = eval(comp.metadata[component.__name__])(**prop_dict)
Expand Down Expand Up @@ -823,17 +849,6 @@ def generate_props(src, component, comp):
print(f"Failed to create component {component.__name__}, error: {e}")
comp = rx.fragment()

is_interactive = True
if isinstance(comp, Fragment):
is_interactive = False

body = rx.table.body(
*[
rx.table.row(*prop_docs(prop, prop_dict, component, is_interactive), align="center")
for prop in src.get_props()
if not prop.name.startswith("on_") # ignore event trigger props
]
)
return rx.vstack(
docdemobox(comp) if not isinstance(comp, Fragment) else "",
rx.scroll_area(
Expand Down

0 comments on commit ec7685a

Please sign in to comment.