Spaces:
Runtime error
Runtime error
Upload styling.py
Browse files- styling.py +75 -0
styling.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
8 |
+
#footer
|
9 |
+
def image(src_as_string, **style):
|
10 |
+
return img(src=src_as_string, style=styles(**style))
|
11 |
+
|
12 |
+
|
13 |
+
def link(link, text, **style):
|
14 |
+
return a(_href=link, _target="_blank", style=styles(**style))(text)
|
15 |
+
|
16 |
+
|
17 |
+
def layout(*args):
|
18 |
+
|
19 |
+
style = """
|
20 |
+
<style>
|
21 |
+
# MainMenu {visibility: hidden;}
|
22 |
+
footer {visibility: hidden;}
|
23 |
+
.stApp { bottom: 105px; }
|
24 |
+
</style>
|
25 |
+
"""
|
26 |
+
|
27 |
+
style_div = styles(
|
28 |
+
position="fixed",
|
29 |
+
left=0,
|
30 |
+
bottom=0,
|
31 |
+
margin=px(0, 0, 0, 0),
|
32 |
+
width=percent(100),
|
33 |
+
color="black",
|
34 |
+
text_align="center",
|
35 |
+
height="auto",
|
36 |
+
opacity=1
|
37 |
+
)
|
38 |
+
|
39 |
+
style_hr = styles(
|
40 |
+
display="block",
|
41 |
+
margin=px(8, 8, "auto", "auto"),
|
42 |
+
border_style="inset",
|
43 |
+
border_width=px(2)
|
44 |
+
)
|
45 |
+
|
46 |
+
body = p()
|
47 |
+
foot = div(
|
48 |
+
style=style_div
|
49 |
+
)(
|
50 |
+
hr(
|
51 |
+
style=style_hr
|
52 |
+
),
|
53 |
+
body
|
54 |
+
)
|
55 |
+
|
56 |
+
st.markdown(style, unsafe_allow_html=True)
|
57 |
+
|
58 |
+
for arg in args:
|
59 |
+
if isinstance(arg, str):
|
60 |
+
body(arg)
|
61 |
+
|
62 |
+
elif isinstance(arg, HtmlElement):
|
63 |
+
body(arg)
|
64 |
+
|
65 |
+
st.markdown(str(foot), unsafe_allow_html=True)
|
66 |
+
|
67 |
+
|
68 |
+
def footer():
|
69 |
+
myargs = [
|
70 |
+
" with ❤️ by ",
|
71 |
+
link("https://twitter.com/AbrahamOwos", "@AbrahamOwos"),
|
72 |
+
br(),
|
73 |
+
" ⚙️ Want me to change or add someing? Hit me up" ,
|
74 |
+
]
|
75 |
+
layout(*myargs)
|