Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs update code success #900

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
35 changes: 17 additions & 18 deletions solara/website/pages/documentation/components/status/success.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,23 @@

@solara.component
def Page():
icon, set_icon = solara.use_state(True)
dense, set_dense = solara.use_state(False)
outlined, set_outlined = solara.use_state(True)
text, set_text = solara.use_state(True)
with solara.VBox() as main:
with solara.GridFixed(4):
solara.Checkbox(label="Use icon", value=icon, on_value=set_icon)
solara.Checkbox(label="Show dense", value=dense, on_value=set_dense)
solara.Checkbox(label="Show as text", value=text, on_value=set_text)
solara.Checkbox(label="Show outlined", value=outlined, on_value=set_outlined)
solara.Success(
f"This is solara.Success(label='...', text={text}, dense={dense}, outlined={outlined}, icon={icon})",
text=text,
dense=dense,
outlined=outlined,
icon=icon,
)
return main
icon = solara.use_reactive(True)
dense = solara.use_reactive(False)
outlined = solara.use_reactive(True)
text = solara.use_reactive(True)

with solara.GridFixed(4):
solara.Checkbox(label="Use icon", value=icon)
solara.Checkbox(label="Show dense", value=dense)
solara.Checkbox(label="Show as text", value=text)
solara.Checkbox(label="Show outlined", value=outlined)
solara.Success(
f"This is solara.Success(label='...', text={text}, dense={dense}, outlined={outlined}, icon={icon})",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the .values here instead of the reactives

Suggested change
f"This is solara.Success(label='...', text={text}, dense={dense}, outlined={outlined}, icon={icon})",
f"This is solara.Success(label='...', text={text.value}, dense={dense.value}, outlined={outlined.value}, icon={icon.value})",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I already fixed it. If there is any issues, please let me know.

text=text,
dense=dense,
outlined=outlined,
icon=icon,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here

Suggested change
text=text,
dense=dense,
outlined=outlined,
icon=icon,
text=text.value,
dense=dense.value,
outlined=outlined.value,
icon=icon.value,

)


__doc__ += apidoc(solara.Success.f) # type: ignore
Loading