Iamgm commited on
Commit
0ec1b0f
·
1 Parent(s): 2a10f57

some css styles changes

Browse files
Files changed (1) hide show
  1. src/ui/app.py +28 -21
src/ui/app.py CHANGED
@@ -147,28 +147,35 @@ st.markdown(f"""
147
  border-radius: 8px;
148
  }}
149
 
150
- /* фиксация и сдвиг */
151
- @media (min-width: 992px) {{
152
- /* 1. Фиксируем сайдбар и задаем ему ширину 300px */
153
- [data-testid="stSidebar"] {{
154
- position: fixed !important;
155
- top: 0 !important;
156
- left: 0 !important;
157
- height: 100vh !important;
158
- width: 300px !important;
159
- z-index: 99999 !important;
160
- overflow-y: auto !important;
161
- }}
162
-
163
- /* cдвигаем основной контент вправо на 300px */
164
- [data-testid="stMain"] {{
165
- margin-left: 300px !important;
166
- width: calc(100% - 300px) !important;
 
 
 
 
 
 
 
 
 
167
  }}
168
-
169
- /* cкрываем кнопку закрытия сайдбара, т.к. при фиксации она может ломать верстку */
170
- [data-testid="stSidebarCollapseButton"] {{
171
- display: none !important;
172
  }}
173
  }}
174
  /* ------------------------ */
 
147
  border-radius: 8px;
148
  }}
149
 
150
+ /* фиксация сайдбара */
151
+ /* оставляем "пустую" оболочку сайдбара */
152
+ [data-testid="stSidebar"] {{
153
+ min-width: 300px !important;
154
+ max-width: 300px !important;
155
+ flex-shrink: 0 !important;
156
+ }}
157
+
158
+ /* а вот содержимое фиксируем намертво */
159
+ [data-testid="stSidebarContent"] {{
160
+ position: fixed !important;
161
+ top: 0 !important;
162
+ left: 0 !important;
163
+ width: 300px !important; /* Должно совпадать с шириной оболочки */
164
+ height: 100vh !important;
165
+ overflow-y: auto !important;
166
+ z-index: 10000 !important;
167
+ background-color: #f0f2f6;
168
+ }}
169
+
170
+ /* на мобильных убираем фиксацию, иначе сломается */
171
+ @media (max-width: 768px) {{
172
+ [data-testid="stSidebarContent"] {{
173
+ position: relative !important;
174
+ width: 100% !important;
175
+ height: auto !important;
176
  }}
177
+ [data-testid="stSidebar"] {{
178
+ min-width: 100% !important;
 
 
179
  }}
180
  }}
181
  /* ------------------------ */