Spaces:
Running
Running
castledan
commited on
Commit
·
15c025a
1
Parent(s):
975ad67
add sidebar title
Browse files- app/src/config_parameters.py +2 -1
- app/src/utils_layout.py +9 -16
app/src/config_parameters.py
CHANGED
@@ -5,8 +5,9 @@ config = {
|
|
5 |
# Sidebar
|
6 |
"MA_logo_width": "60%",
|
7 |
"MA_logo_background_position": "35% 10%",
|
|
|
8 |
"sidebar_header_fontsize": "30px",
|
9 |
-
"sidebar_header_fontweight": "
|
10 |
"about_box_background_color": "#dae7f4",
|
11 |
# Introduction and Documentation
|
12 |
"docs_fontsize": "1.2rem",
|
|
|
5 |
# Sidebar
|
6 |
"MA_logo_width": "60%",
|
7 |
"MA_logo_background_position": "35% 10%",
|
8 |
+
"sidebar_header": "Flood Mapping Tool",
|
9 |
"sidebar_header_fontsize": "30px",
|
10 |
+
"sidebar_header_fontweight": "bold",
|
11 |
"about_box_background_color": "#dae7f4",
|
12 |
# Introduction and Documentation
|
13 |
"docs_fontsize": "1.2rem",
|
app/src/utils_layout.py
CHANGED
@@ -29,9 +29,6 @@ def toggle_menu_button():
|
|
29 |
|
30 |
|
31 |
# Sidebar
|
32 |
-
sidebar_title = "Flood Mapping Tool"
|
33 |
-
|
34 |
-
|
35 |
@st.cache(allow_output_mutation=True)
|
36 |
def get_base64_of_bin_file(png_file):
|
37 |
"""
|
@@ -50,11 +47,6 @@ def get_base64_of_bin_file(png_file):
|
|
50 |
|
51 |
def build_markup_for_logo(
|
52 |
png_file,
|
53 |
-
background_position=f"{config['MA_logo_background_position']}",
|
54 |
-
image_width=f"{config['MA_logo_width']}",
|
55 |
-
image_height="",
|
56 |
-
sidebar_header_fontsize=config["sidebar_header_fontsize"],
|
57 |
-
sidebar_header_fontweight=config["sidebar_header_fontweight"],
|
58 |
):
|
59 |
"""
|
60 |
Create full string for navigation bar, including logo and title.
|
@@ -80,25 +72,25 @@ def build_markup_for_logo(
|
|
80 |
background-size: %s %s;
|
81 |
}
|
82 |
[data-testid="stSidebarNav"]::before {
|
83 |
-
content: %s;
|
84 |
margin-left: 20px;
|
85 |
margin-top: 20px;
|
86 |
margin-bottom: 20px;
|
87 |
-
padding-bottom: 50px;
|
88 |
font-size: %s;
|
89 |
font-weight: %s;
|
90 |
position: relative;
|
|
|
91 |
top: 85px;
|
92 |
}
|
93 |
</style>
|
94 |
""" % (
|
95 |
binary_string,
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
sidebar_header_fontsize,
|
101 |
-
sidebar_header_fontweight,
|
102 |
)
|
103 |
|
104 |
|
@@ -112,6 +104,7 @@ def add_logo(png_file):
|
|
112 |
None
|
113 |
"""
|
114 |
logo_markup = build_markup_for_logo(png_file)
|
|
|
115 |
st.markdown(
|
116 |
logo_markup,
|
117 |
unsafe_allow_html=True,
|
|
|
29 |
|
30 |
|
31 |
# Sidebar
|
|
|
|
|
|
|
32 |
@st.cache(allow_output_mutation=True)
|
33 |
def get_base64_of_bin_file(png_file):
|
34 |
"""
|
|
|
47 |
|
48 |
def build_markup_for_logo(
|
49 |
png_file,
|
|
|
|
|
|
|
|
|
|
|
50 |
):
|
51 |
"""
|
52 |
Create full string for navigation bar, including logo and title.
|
|
|
72 |
background-size: %s %s;
|
73 |
}
|
74 |
[data-testid="stSidebarNav"]::before {
|
75 |
+
content: "%s";
|
76 |
margin-left: 20px;
|
77 |
margin-top: 20px;
|
78 |
margin-bottom: 20px;
|
|
|
79 |
font-size: %s;
|
80 |
font-weight: %s;
|
81 |
position: relative;
|
82 |
+
text-align: center;
|
83 |
top: 85px;
|
84 |
}
|
85 |
</style>
|
86 |
""" % (
|
87 |
binary_string,
|
88 |
+
config["MA_logo_background_position"],
|
89 |
+
config["MA_logo_width"],
|
90 |
+
"",
|
91 |
+
config["sidebar_header"],
|
92 |
+
config["sidebar_header_fontsize"],
|
93 |
+
config["sidebar_header_fontweight"],
|
94 |
)
|
95 |
|
96 |
|
|
|
104 |
None
|
105 |
"""
|
106 |
logo_markup = build_markup_for_logo(png_file)
|
107 |
+
# st.sidebar.title("ciao")
|
108 |
st.markdown(
|
109 |
logo_markup,
|
110 |
unsafe_allow_html=True,
|