Skip to content

docs update code resolve_path #879

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
29 changes: 14 additions & 15 deletions solara/website/pages/documentation/api/routing/resolve_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@
@solara.component
def Page():
route_current, routes = solara.use_route()
with solara.VBox() as main:
# solara.Warning("Note the address bar in the browser. It should change to the path of the link.")
solara.Markdown("*Click on one of the links below to change the route and see the url in your browser change, and match the text.*")
with solara.VBox():
for route in routes:
path = solara.resolve_path(route)
# we could have passed the route object directly to Link, but we want to show the path
# can also be used.
with solara.Link(path):
current = route_current is route
if current:
solara.Success(f"You are at {path}")
else:
solara.Info(f"{route.path} will navigate to {path}")
return main

# solara.Warning("Note the address bar in the browser. It should change to the path of the link.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the comment can be removed here too.

Suggested change
# solara.Warning("Note the address bar in the browser. It should change to the path of the link.")

solara.Markdown("*Click on one of the links below to change the route and see the url in your browser change, and match the text.*")
with solara.VBox():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another while we're here update:

Suggested change
with solara.VBox():
with solara.Column():

for route in routes:
path = solara.resolve_path(route)
# we could have passed the route object directly to Link, but we want to show the path
# can also be used.
with solara.Link(path):
current = route_current is route
if current:
solara.Success(f"You are at {path}")
else:
solara.Info(f"{route.path} will navigate to {path}")


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