import streamlit as st
from htbuilder import HtmlElement, a, div, img, p, styles
from htbuilder.units import percent, px
from streamlit.components.v1 import html
def image(src_as_string, **style):
return img(src=src_as_string, style=styles(**style))
def link(link, text, **style):
return a(_href=link, _target="_blank", style=styles(**style))(text)
def layout(*args):
style = """
"""
style_div = styles(
position="fixed",
left=0,
bottom=0,
margin=px(0, 0, 0, 0),
width=percent(100),
color="black",
text_align="center",
height="auto",
opacity=1,
align_items="center",
flex_direction="column",
display="flex",
)
body = p(
id="myFooter",
style=styles(
margin=px(0, 0, 0, 0),
padding=px(5),
font_size="0.9rem",
color="rgb(51,51,51)",
font_family="Exo",
),
)
foot = div(style=style_div)(body)
st.markdown(style, unsafe_allow_html=True)
for arg in args:
if isinstance(arg, str) or isinstance(arg, HtmlElement):
body(arg)
st.markdown(str(foot), unsafe_allow_html=True)
js_code = """
"""
html(js_code)
def footer():
myargs = [
"Made in 🇮🇹 with ",
link(
"https://streamlit.io/",
image("https://streamlit.io/images/brand/streamlit-mark-color.png", width="18px"),
),
" by ",
link("https://twitter.com/grsFabio", "@grsFabio"),
" ",
link(
"https://www.buymeacoffee.com/fabiogra",
image("https://i.imgur.com/YFu6MMA.png", margin="0em", align="top", width="130px"),
),
]
layout(*myargs)