Skip to content

Commit

Permalink
refactor: accommodate new pages
Browse files Browse the repository at this point in the history
  • Loading branch information
iisakkirotko committed Mar 11, 2024
1 parent 5c59133 commit ac47787
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 158 deletions.
1 change: 1 addition & 0 deletions solara/website/assets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ blockquote p:last-child {
}

.solara-autorouter-content {
padding-top: 2rem;
max-width: 100%;
}

Expand Down
2 changes: 1 addition & 1 deletion solara/website/components/algolia_api.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
rounded
clearable
ref="search"
style="max-width: 50%; background-color: #fff; flex-grow: 1;"
style="max-width: 50%; flex-grow: 1;"
@click="show($event, on);"
@keyup.enter="item = 0"
></v-text-field>
Expand Down
38 changes: 21 additions & 17 deletions solara/website/components/docs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from pathlib import Path

import solara
from solara.alias import rv

Expand Down Expand Up @@ -30,30 +28,36 @@ def Gallery(route_external=None):
if route.children:
with solara.Column(classes=["subcategory-row", "ps-md-10"]):
solara.HTML(tag="h2", unsafe_innerHTML=route.label, attributes={"id": route.path}, style="padding-left: 10%;")
with solara.Row(justify="center", gap="20px", style={"flex-wrap": "wrap", "row-gap": "20px"}):
with solara.Row(justify="center", gap="20px", style={"flex-wrap": "wrap", "row-gap": "20px", "max-width": "90rem"}):
for child in route.children:
if child.path == "/":
continue
path = route.path + "/" + child.path
for extension in [".png", ".gif"]:
image = path + extension
image_path = Path(__file__).parent.parent / "public" / route_current.path / image
image_url = "/static/public/" + route_current.path + "/" + image
if image_path.exists():
break
else:
image_url = "/static/public/logo.svg"
if child.path in [
"button",
"checkbox",
"confirmation_dialog",
"echarts",
"file_browser",
"file_download",
"matplotlib",
"select",
"switch",
"tooltip",
]:
image_url = "https://dxhl76zpt6fap.cloudfront.net/public/api/" + child.path + ".gif"
elif child.path in ["card", "dataframe", "pivot_table", "slider"]:
image_url = "https://dxhl76zpt6fap.cloudfront.net/public/api/" + child.path + ".png"
else:
image_url = "https://dxhl76zpt6fap.cloudfront.net/public/logo.svg"

if path:
path = path if route_external is None else route_current.path + "/" + path
title = solara.Link(path, children=[child.label])
with solara.Card(title, classes=["component-card"], margin=0):
with solara.Link(path):
if not image_path.exists():
with solara.Column(align="center"):
solara.Image(image_url, width="120px")
else:
solara.Image(image_url, width="100%")
with solara.Column(align="center"):
with solara.Link(path):
solara.Image(image_url, width="12rem")


@solara.component
Expand Down
121 changes: 0 additions & 121 deletions solara/website/pages/docs/content/00-introduction.md

This file was deleted.

33 changes: 16 additions & 17 deletions solara/website/pages/documentation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,22 @@ def Sidebar():
if item.path != "fullscreen"
else "/apps/" + subitem.path
)
with solara.v.ListItemGroup():
with solara.Link(
path,
):
with solara.v.ListItem(dense=True, style_="padding: 0 20px;"):
solara.v.ListItemContent(
children=[subitem.label],
)
else:
with solara.v.ListItemGroup():
with solara.Link(
"/documentation/" + route.path + "/" + item.path,
):
with solara.v.ListItem(dense=True, style_="padding: 0 20px;"):
solara.v.ListItemContent(
children=[item.label],
)
with solara.Link(
path,
):
with solara.v.ListItem(dense=True, style_="padding: 0 20px;"):
solara.v.ListItemContent(
children=[subitem.label],
)
else:
with solara.v.ListItemGroup():
with solara.Link(
"/documentation/" + route.path + "/" + item.path,
):
with solara.v.ListItem(dense=True, style_="padding: 0 20px;"):
solara.v.ListItemContent(
children=[item.label],
)
solara.v.Spacer(style_="flex-grow: 1;")
with solara.v.ListItemGroup():
with solara.Link("/contact"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ def Page():
"""

import solara
from solara.website.components import NoPage
from solara.website.utils import apidoc

from . import NoPage

title = "Themes"
Page = NoPage
__doc__ += apidoc(solara.lab.ThemeToggle) # type: ignore

0 comments on commit ac47787

Please sign in to comment.