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 warining #901

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Changes from 10 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 22 additions & 25 deletions solara/website/pages/documentation/components/status/warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,28 @@

@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.Warning(
f"This is solara.Warning(label='...', text={text}, dense={dense}, outlined={outlined}, icon={icon})",
text=text,
dense=dense,
outlined=outlined,
icon=icon,
)
solara.Warning(
f"This is solara.Warning(label='...', text={text}, dense={dense}, outlined={outlined}, icon={icon})",
text=text,
dense=dense,
outlined=outlined,
icon=icon,
)
return main
state = solara.use_reactive(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
state = solara.use_reactive(
icon = solare.use_reactive(True)
state = solara.use_reactive(

{
"icon": True,
"dense": False,
"outlined": True,
"text": True,
}
)

with solara.GridFixed(4):
solara.Checkbox(label="Use icon", value=state.value["icon"], on_value=lambda val: state.value.update({"icon": val}))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
solara.Checkbox(label="Use icon", value=state.value["icon"], on_value=lambda val: state.value.update({"icon": val}))
solara.Checkbox(label="Use icon", value=icon)

solara.Checkbox(label="Show dense", value=state.value["dense"], on_value=lambda val: state.value.update({"dense": val}))
solara.Checkbox(label="Show as text", value=state.value["text"], on_value=lambda val: state.value.update({"text": val}))
solara.Checkbox(label="Show outlined", value=state.value["outlined"], on_value=lambda val: state.value.update({"outlined": val}))

solara.Warning(
f"This is solara.Warning(label='...', text={state.value['text']}, dense={state.value['dense']}, outlined={state.value['outlined']}, icon={state.value['icon']})",
text=state.value["text"],
dense=state.value["dense"],
outlined=state.value["outlined"],
icon=state.value["icon"],
)


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