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

Conversation

lizzy985
Copy link
Contributor

@lizzy985 lizzy985 commented Dec 2, 2024

No description provided.

Comment on lines 21 to 23
dense, set_dense = solara.use_state(False)
outlined, set_outlined = solara.use_state(True)
text, set_text = solara.use_state(True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can also replace use_state with use_reactive here.

Comment on lines 37 to 43
solara.Warning(
f"This is solara.Warning(label='...', text={text}, dense={dense}, outlined={outlined}, icon={icon})",
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.

This is duplicate for some reason. Strange that we never noticed.

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

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 fix the two issues, if there is still any problem, please let me know.

Copy link
Contributor

@maartenbreddels maartenbreddels left a comment

Choose a reason for hiding this comment

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

I this this style is easier to read, and easier for newcomers

)

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)

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(

@maartenbreddels maartenbreddels force-pushed the master branch 2 times, most recently from cded5b2 to 32af76f Compare December 20, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants