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

Feature/plotly theming #6

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
36bec62
Feat(plotly_theme): added theme and configuration options for plotly …
GedionT Oct 14, 2024
53b5f1e
Feat(plotly_components): added plotly chart components
GedionT Oct 14, 2024
a57d6d1
Feat(st_undp): apply plotly theme and export components
GedionT Oct 14, 2024
3ced4a9
Feat(integration): added an integration page for charts
GedionT Oct 14, 2024
5e8ddb6
Fix(app): added integration page to navigation
GedionT Oct 14, 2024
2c784cb
Feat(lib): added plotly dependency in poetry
GedionT Oct 14, 2024
ecb6e52
Fix(plotly-menu): underlined animation effect fixed for plotly chart …
GedionT Oct 14, 2024
13752cc
Fix(link-animation): link underline animation on hover fixed
GedionT Oct 14, 2024
6342f71
Fix(checkbox): removed custom icon for checkbox
GedionT Oct 14, 2024
fb5aeab
Refactor(formatting): code formatting applied
GedionT Oct 14, 2024
1a8a102
Chore(poetry): update lock file
GedionT Oct 14, 2024
792edcd
Refactor(about): code format and linting
GedionT Oct 14, 2024
e7dcc43
Refactor(custom-pages): linting and code formatting
GedionT Oct 14, 2024
7e6383a
Refactor(standard): removed unused module
GedionT Oct 14, 2024
f838ea9
Refactor(st_undp): linting and code formatting in main and adding enc…
GedionT Oct 14, 2024
7e11a9f
Docs(plotly): added basic docstrings
GedionT Oct 14, 2024
2685c72
Fix(style): code padding and visited link fix
GedionT Oct 15, 2024
4fa77e1
Refactor(lint): removed line break character
GedionT Oct 15, 2024
dec57ae
Fix(lint): removed line break character for readability
GedionT Oct 15, 2024
7c86dd9
Feat(standard): added expander to text tab
GedionT Oct 15, 2024
d219e18
Docs(readme): added plotly feature to readme
GedionT Oct 15, 2024
16dacae
Refactor(app): renamed integration -> extras
GedionT Nov 25, 2024
ff63800
Refactor(custom): renamed code_str -> code_body and lowercased
GedionT Nov 25, 2024
2741ff7
Chore(plotly_components): removed plotly components in place of solid…
GedionT Nov 25, 2024
8821050
Refactor(extras): replaced pages/integrations -> pages/extras and sho…
GedionT Nov 25, 2024
cae1234
Refactor(plotly_theme): cleaned up and modularized plotly theme
GedionT Nov 25, 2024
38e6f40
Refactor(__init__): conditionally apply plotly theme
GedionT Nov 25, 2024
94fb7cc
Feat(standard): added an expander in standard demo
GedionT Nov 25, 2024
6c89342
Docs(main.scss): added brief comments
GedionT Nov 25, 2024
da17112
Feat(plotly-theme): added a json configuration file for Plotly
GedionT Nov 25, 2024
d8eb3fc
Feat(undp-colors): added a color config file for reference
GedionT Nov 25, 2024
16d1733
Refactor(app): applied formatting
GedionT Nov 25, 2024
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
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ python -m st_undp configure
```

This will edit the theme section in the file if it exists or create it if it doesn't.
Then, call `apply_style` function inside your application entry point, typically `app.py`:
Then, call `apply_style` function inside your application entry point, typically `app.py`:

```python
import st_undp
Expand All @@ -63,6 +63,7 @@ This package is currently in the early stages of development. Main features incl
- `ProximaNova` fonts
- CSS styles for most Streamlit input components
- Several custom components from the UNDP Design System, such as Author, Footer, Header, Stats Card
- Custom UNDP themed for Plotly and ready-made Plotly charts.
- No additional dependencies on top of what is required by `streamlit`

## Contributing
Expand All @@ -81,16 +82,16 @@ routine operations.

## License

This project is licensed under the BSD 3-Clause License. However, entities or individuals not affiliated with UNDP
are strictly prohibited from using this package or any of its components to create, share, publish, or distribute works
This project is licensed under the BSD 3-Clause License. However, entities or individuals not affiliated with UNDP
are strictly prohibited from using this package or any of its components to create, share, publish, or distribute works
that resemble, claim affiliation with, or imply endorsement by UNDP.

UNDP’s name, emblem and its abbreviation are the exclusive property of UNDP and are protected under international law.
Their unauthorized use is prohibited, and they may not be reproduced or used in any manner without UNDP’s prior written permission.
UNDP’s name, emblem and its abbreviation are the exclusive property of UNDP and are protected under international law.
Their unauthorized use is prohibited, and they may not be reproduced or used in any manner without UNDP’s prior written permission.

## Contact

This project is part of [Data Futures Exchange (DFx)](https://data.undp.org) at UNDP.
If you are facing any issues or would like to make some suggestions, feel free to
[open an issue](https://github.com/undp-data/st-undp/issues/new/choose).
If you are facing any issues or would like to make some suggestions, feel free to
[open an issue](https://github.com/undp-data/st-undp/issues/new/choose).
For enquiries about DFx, visit [Contact Us](https://data.undp.org/contact-us).
1 change: 1 addition & 0 deletions app.py
GedionT marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
title="custom components",
url_path="/custom",
),
st.Page(page="pages/extras.py", title="extras", url_path="/extras"),
st.Page(
page="pages/about.py",
title="about",
Expand Down
2 changes: 1 addition & 1 deletion pages/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
st_undp.featured_card(
src="app/static/github.jpg",
title="UNDP Data GitHub",
summary="Leverage open source projects for data visualisation, geospatial analytics and artificial intelligence",
summary="Leverage open source projects for data visualisation, geo-spatial analytics and artificial intelligence",
href="https://github.com/undp-data",
tag="resource",
)
Expand Down
84 changes: 42 additions & 42 deletions pages/custom.py
GedionT marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
]
)
with tab1:
code = """
code_body = """
st_undp.author(
src="app/static/aristotle.jpg",
name="Aristotle",
title="Ancient Greek philosopher and polymath",
href="https://en.wikipedia.org/wiki/Aristotle",
)
"""
eval(code.strip())
eval(code_body.strip())
with st.expander("Show Code"):
st.code(code)
st.code(code_body)

with tab2:
code = """
code_body = """
st_undp.author_card(
src="app/static/aristotle.jpg",
name="Aristotle",
Expand All @@ -42,25 +42,25 @@
href="https://en.wikipedia.org/wiki/Aristotle",
)
"""
eval(code.strip())
eval(code_body.strip())
with st.expander("Show Code"):
st.code(code)
st.code(code_body)

with tab3:
code = """
code_body = """
st_undp.author_summary(
src="app/static/aristotle.jpg",
name="Aristotle",
title="Ancient Greek philosopher and polymath",
summary="As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science."
)
"""
eval(code.strip())
eval(code_body.strip())
with st.expander("Show Code"):
st.code(code)
st.code(code_body)

with tab4:
code = """
code_body = """
st_undp.breadcrumb(
{
"Home": "/",
Expand All @@ -69,15 +69,15 @@
}
)
"""
eval(code.strip())
eval(code_body.strip())
with st.expander("Show Code"):
st.code(code)
st.code(code_body)

with tab5:
st.subheader("Content Card")
body = "Use st.columns to arrange multiple cards in a row."
st.info(body, icon=":material/lightbulb:")
code = """
BODY = "Use st.columns to arrange multiple cards in a row."
st.info(BODY, icon=":material/lightbulb:")
code_body = """
st_undp.content_card(
src="app/static/aristotle.jpg",
caption="Nicomachean Ethics is closely related to Eudemian Ethics",
Expand All @@ -91,12 +91,12 @@
for _ in range(rows):
for col in st.columns(cols):
with col:
eval(code)
eval(code_body)
with st.expander("Show Code"):
st.code(code)
st.code(code_body)

with tab6:
code = """
code_body = """
st_undp.download_card(
src="app/static/aristotle.jpg",
title="Corpus Aristotelicum",
Expand All @@ -107,12 +107,12 @@
""".strip()
for col, variant in zip(st.columns(3), ("publication", "card", "default")):
with col:
eval(code.format(variant))
eval(code_body.format(variant))
with st.expander("Show Code"):
st.code(code.format(variant))
st.code(code_body.format(variant))

with tab7:
code = """
code_body = """
st_undp.featured_card(
src="app/static/aristotle.jpg",
title="Nicomachean Ethics",
Expand All @@ -121,13 +121,13 @@
width=6,
)
""".strip()
eval(code)
eval(code_body)
with st.expander("Show Code"):
st.code(code)
st.code(code_body)

with tab8:
body = "Make sure to call the footer function at the bottom of your script outside of any tab, column etc."
st.info(body, icon=":material/lightbulb:")
info_body = "Make sure to call the footer function at the bottom of your script outside of any tab, column etc."
st.info(info_body, icon=":material/lightbulb:")
footer = st.radio(
label="Footer",
options=("None", "UNDP (Default)", "UNDP DFx", "Custom"),
Expand All @@ -136,9 +136,9 @@

footer = footer.lower()
if "default" in footer:
code = """st_undp.footer()"""
code_body = """st_undp.footer()"""
elif "dfx" in footer:
code = """st_undp.footer("dfx")"""
code_body = """st_undp.footer("dfx")"""
elif "custom" in footer:
columns = {
"focus areas": {
Expand All @@ -153,61 +153,61 @@
},
}
st.json(columns)
code = """st_undp.footer(columns)"""
code_body = """st_undp.footer(columns)"""
else:
code = "None"
code_body = "None"
eval(code_body)
with st.expander("Show Code"):
st.code(code)
eval(code)
st.code(code_body)

with tab9:
logo = st.radio("Logo", ("UNDP", "PNUD"), key="logo", horizontal=True)
title = st.text_input("Header Title", key="title")
subtitle = st.text_input("Header Subtitle", key="subtitle")
code = f"""
code_body = f"""
st_undp.header(
title="{title}",
subtitle="{subtitle}",
logo="{logo.lower()}",
)
""".strip()
with st.expander("Show Code"):
st.code(code)
st.code(code_body)

with tab10:
code = """
code_body = """
st_undp.image_card(
src="app/static/aristotle.jpg",
summary="Nicomachean Ethics is Aristotle's best-known works on ethics: the science of the good for human life, that which is the goal or end at which all our actions aim",
href="https://en.wikipedia.org/wiki/Nicomachean_Ethics",
width=3,
)
""".strip()
eval(code)
eval(code_body)
with st.expander("Show Code"):
st.code(code)
st.code(code_body)

with tab11:
col1, col2 = st.columns(2)
with col1:
code = """
code_body = """
st_undp.stats_card(
value=3.14,
title="Pi",
text="Pi is a mathematical constant that is the ratio of a circle's circumference to its diameter",
)
"""
eval(code.strip())
eval(code_body.strip())
with st.expander("Show Code"):
st.code(code)
st.code(code_body)
with col2:
code = """
code_body = """
st_undp.stats_card(
value=2.71,
title="Euler's constant",
text="Euler's constant is is a mathematical constant, defined as the limiting difference between the harmonic series and the natural logarithm",
)
"""
eval(code.strip())
eval(code_body.strip())
with st.expander("Show Code"):
st.code(code)
st.code(code_body)
Loading