Skip to content

Commit

Permalink
Fix syntax, add no-icon section to test
Browse files Browse the repository at this point in the history
  • Loading branch information
blackary committed Sep 10, 2024
1 parent 86bc27b commit 89816a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 10 additions & 0 deletions example_app/.streamlit/pages_sections.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ path = "example_five.py"
name = "Example Five"
icon = "🧰"
url_path = "a_very_long_page_title"

[[pages]]
name = "Section with no icon"
is_section = true

[[pages]]
path = "example_five.py"
name = "Another example five!"
icon = "😵‍💫"
url_path = "example_five_title2"
4 changes: 1 addition & 3 deletions src/st_pages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ def _get_pages_from_config(path: str = ".streamlit/pages.toml") -> list[Page] |
for page in raw_pages:
if page.get("is_section"):
page["path"] = ""
pages.append(
Section(page["name"], page["icon"] if hasattr(page, "icon") else None)
) # type: ignore
pages.append(Section(page["name"], page.get("icon", None))) # type: ignore
else:
pages.append(Page(**page)) # type: ignore

Expand Down

0 comments on commit 89816a1

Please sign in to comment.