import streamlit as st def custom_metric_box(label: str, value: str) -> None: """ Create a styled metric box with a compact layout. This function generates a styled markdown box displaying a label and its corresponding value. Parameters: ---------- label : str The text label to display in the metric box. value : str The value to be displayed in the metric box, typically representing a metric. Returns: ------- None """ st.markdown( f"""

{label}

{value}

""", unsafe_allow_html=True, ) def pollution_box(label: str, value: str, delta: str, threshold: float) -> None: """ Create a pollution metric box with a side-by-side layout and fixed width. This function generates a styled markdown box displaying pollution level status, value, and other related information. Parameters: ---------- label : str The text label representing the type of pollution or metric. value : str The value of the pollution metric, typically a string that can be converted to a float. delta : str A string representing the change in pollution level, though not currently used in the rendering. threshold : float The threshold value to determine if the pollution level is "Good" or "Bad". Returns: ------- None """ # Determine if the pollution level is "Good" or "Bad" status = "Good" if float(value.split()[0]) < threshold else "Bad" status_color = "#77C124" if status == "Good" else "#E68B0A" # Render the pollution box st.markdown( f"""

{label}

{status}

{value}

""", unsafe_allow_html=True, )