georad commited on
Commit
fe2d7a3
·
verified ·
1 Parent(s): bee7cf0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -22
app.py CHANGED
@@ -1,42 +1,40 @@
1
  import streamlit as st
2
 
3
  # Set page config
4
- st.set_page_config(page_title="Fixed Status Widget", layout="wide")
5
 
6
- # CSS to specifically target the status widget and make it sticky
7
  st.markdown("""
8
  <style>
9
- /* Target the status widget container */
10
- [data-testid="stStatusWidget"] {
 
11
  position: fixed !important;
12
- top: 0px;
13
- z-index: 1000000;
14
- width: auto;
15
- right: 0px;
16
- background-color: white;
17
- padding: 4px;
18
- border-bottom-left-radius: 4px;
19
- box-shadow: 0 0 4px rgba(0,0,0,0.1);
20
  }
21
 
22
- /* Add padding to the top of the main content */
23
- .main .block-container {
24
- padding-top: 2rem;
 
25
  }
26
  </style>
27
  """, unsafe_allow_html=True)
28
 
29
  # Your regular Streamlit app content
30
  st.title("App with Fixed Status Widget")
 
31
 
32
- # Add sample content to demonstrate scrolling
33
- st.write("Scroll down to see the status widget remain fixed at the top")
34
-
35
- # Generate content to enable scrolling
36
  for i in range(30):
37
- st.write(f"Content line {i}")
38
- if i % 5 == 0:
39
- st.markdown("---")
40
 
41
 
42
  # --- SHARED ON ALL PAGES ---
 
1
  import streamlit as st
2
 
3
  # Set page config
4
+ st.set_page_config(page_title="Fixed Status Widget Approach 2", layout="wide")
5
 
6
+ # More specific CSS targeting just the status widget
7
  st.markdown("""
8
  <style>
9
+ /* Very specific targeting of the status widget */
10
+ div[data-testid="stStatusWidget"],
11
+ div:has(> div[data-testid="stStatusWidget"]) {
12
  position: fixed !important;
13
+ top: 5px !important;
14
+ right: 5px !important;
15
+ z-index: 1000000 !important;
16
+ background-color: white !important;
17
+ border-radius: 4px !important;
18
+ box-shadow: 0 0 10px rgba(0,0,0,0.15) !important;
 
 
19
  }
20
 
21
+ /* Ensure the status button stays visible */
22
+ button[kind="formSubmit"] {
23
+ visibility: visible !important;
24
+ display: inline-flex !important;
25
  }
26
  </style>
27
  """, unsafe_allow_html=True)
28
 
29
  # Your regular Streamlit app content
30
  st.title("App with Fixed Status Widget")
31
+ st.write("Scroll down to test if the status widget stays fixed")
32
 
33
+ # Generate content for scrolling
 
 
 
34
  for i in range(30):
35
+ st.write(f"Testing content line {i}")
36
+ if i % 10 == 0:
37
+ st.markdown("### Section Break")
38
 
39
 
40
  # --- SHARED ON ALL PAGES ---