Skip to content

Commit

Permalink
fix: simplify breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels authored and iisakkirotko committed Sep 12, 2024
1 parent aa2340c commit 04ec1d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions solara/website/components/breadcrumbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@


@solara.component
def BreadCrumbs(route_current: solara.Route):
def BreadCrumbs():
router = solara.use_router()
current_path_parts = solara.resolve_path(route_current).split("/")
print("Current path parts", current_path_parts)
routes: List[solara.Route] = _resolve_path_to_route(current_path_parts[1:], router.routes, [])
print("Found routes", [r.path for r in routes])
routes = router.path_routes

with solara.Row(style={"align-items": "center", "flex-wrap": "wrap"}) as main:
for i, route in enumerate(routes):
if i == len(routes) - 1:
solara.Text(route.label, style={"color": "var(--color-text-fade)"})
solara.Text(route.label or route.path, style={"color": "var(--color-text-fade)"})
else:
with solara.Link(solara.resolve_path(route), style={"color": "var(--color-text-fade)"}):
solara.Text(route.label)
solara.Text(route.label or route.path)
if i != len(routes) - 1:
solara.Text("/", style={"font-size": "1.5rem", "color": "var(--color-text-fade)"})
return main
Expand Down
2 changes: 1 addition & 1 deletion solara/website/components/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def NoPage():
def WithCode(route_current):
component = getattr(route_current.module, "Page", None)
with solara.Column(style={"flex-grow": 1, "padding-top": "56px"}) as main:
BreadCrumbs(route_current)
BreadCrumbs()
# It renders code better
MarkdownWithMetadata(
route_current.module.__doc__ or "# no docs yet",
Expand Down

0 comments on commit 04ec1d0

Please sign in to comment.