Spaces:
Sleeping
Sleeping
Create layout.py
Browse files
layout.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from htbuilder import HtmlElement, div, ul, li, br, hr, a, p, img, styles, classes, fonts
|
| 3 |
+
from htbuilder.units import percent, px
|
| 4 |
+
from htbuilder.funcs import rgba, rgb
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def image(src_as_string, **style):
|
| 8 |
+
return img(src=src_as_string, style=styles(**style))
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def link(link, text, **style):
|
| 12 |
+
return a(_href=link, _target="_blank", style=styles(**style))(text)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# MainMenu {visibility: hidden;}
|
| 16 |
+
def layout(*args):
|
| 17 |
+
|
| 18 |
+
hide_stuff = """
|
| 19 |
+
<style>
|
| 20 |
+
#MainMenu {visibility: hidden;}
|
| 21 |
+
footer {visibility: hidden;}
|
| 22 |
+
.stApp { bottom: 105px; }
|
| 23 |
+
</style>
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
style_div = styles(
|
| 27 |
+
position="fixed",
|
| 28 |
+
left=0,
|
| 29 |
+
bottom=0,
|
| 30 |
+
margin=px(0, 0, 0, 0),
|
| 31 |
+
width=percent(100),
|
| 32 |
+
color="black",
|
| 33 |
+
text_align="center",
|
| 34 |
+
height="auto",
|
| 35 |
+
opacity=1
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
style_hr = styles(
|
| 39 |
+
#display="block",
|
| 40 |
+
margin=px(0, 0, "auto", "auto"),
|
| 41 |
+
#border_style="inset",
|
| 42 |
+
border_width=px(3)
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
body = p()
|
| 46 |
+
foot = div(
|
| 47 |
+
style=style_div
|
| 48 |
+
)(
|
| 49 |
+
hr(
|
| 50 |
+
style=style_hr
|
| 51 |
+
),
|
| 52 |
+
body
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
for arg in args:
|
| 56 |
+
if isinstance(arg, str):
|
| 57 |
+
body(arg)
|
| 58 |
+
|
| 59 |
+
elif isinstance(arg, HtmlElement):
|
| 60 |
+
body(arg)
|
| 61 |
+
|
| 62 |
+
st.markdown(hide_stuff, unsafe_allow_html=True)
|
| 63 |
+
st.markdown(str(foot), unsafe_allow_html=True)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def footer():
|
| 67 |
+
myargs = [
|
| 68 |
+
"Made in ",
|
| 69 |
+
image('https://avatars3.githubusercontent.com/u/45109972?s=400&v=4',
|
| 70 |
+
width=px(25), height=px(25)),
|
| 71 |
+
" with ❤️ by ",
|
| 72 |
+
link("https://twitter.com/ChristianKlose3", "@ChristianKlose3"),
|
| 73 |
+
br(),
|
| 74 |
+
link("https://www.buymeacoffee.com/ChrisChross", image('https://i.imgur.com/thJhzOO.png'),),
|
| 75 |
+
]
|
| 76 |
+
layout(*myargs)
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
if __name__ == "__main__":
|
| 80 |
+
footer()
|