milwright commited on
Commit
3261541
·
1 Parent(s): 71cd5b2

Fix button styling consistency issues

Browse files
Files changed (1) hide show
  1. app.py +79 -18
app.py CHANGED
@@ -1246,6 +1246,18 @@ with main_tab1:
1246
 
1247
  # Process button - flush left with similar padding as file browser
1248
  with left_col:
 
 
 
 
 
 
 
 
 
 
 
 
1249
  # Make the button more clear about its function
1250
  if st.session_state.processed_document_active:
1251
  process_button = st.button("Process Document Again")
@@ -2065,22 +2077,39 @@ with main_tab1:
2065
  # Set processed_document_active to True when a new document is processed
2066
  st.session_state.processed_document_active = True
2067
 
2068
- # Add CSS for styling close buttons
2069
  st.markdown("""
2070
  <style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2071
  .close-button {
2072
- background-color: #e7e7e7;
2073
- color: #666;
2074
- border: none;
2075
- border-radius: 4px;
2076
- padding: 0.25rem 0.5rem;
2077
- font-size: 0.8rem;
2078
- cursor: pointer;
2079
- transition: all 0.2s ease;
2080
  }
2081
  .close-button:hover {
2082
- background-color: #d7d7d7;
2083
- color: #333;
2084
  }
2085
  </style>
2086
  """, unsafe_allow_html=True)
@@ -2090,15 +2119,26 @@ with main_tab1:
2090
  with success_cols[0]:
2091
  metadata_placeholder.success("**Document processed successfully**")
2092
  with success_cols[1]:
2093
- # Use a more visually distinctive close button
2094
  st.markdown("""
2095
  <style>
2096
- div[data-testid="stButton"] button {
2097
- background-color: #f8f9fa;
2098
- border: 1px solid #dee2e6;
2099
- padding: 0.25rem 0.5rem;
2100
- font-size: 0.875rem;
2101
- border-radius: 0.2rem;
 
 
 
 
 
 
 
 
 
 
 
2102
  }
2103
  </style>
2104
  """, unsafe_allow_html=True)
@@ -2363,6 +2403,27 @@ with main_tab1:
2363
  if selected_sample > 0:
2364
  selected_url = sample_urls[selected_sample]
2365
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2366
  # Add process button for the sample document
2367
  if st.button("Load Sample Document"):
2368
  try:
 
1246
 
1247
  # Process button - flush left with similar padding as file browser
1248
  with left_col:
1249
+ # Add CSS to ensure process button styling remains consistent
1250
+ st.markdown("""
1251
+ <style>
1252
+ /* Ensure primary buttons stay blue */
1253
+ button[data-testid="baseButton-primary"] {
1254
+ background-color: rgb(19, 119, 187) !important;
1255
+ color: rgb(255, 255, 255) !important;
1256
+ border-color: rgb(19, 119, 187) !important;
1257
+ }
1258
+ </style>
1259
+ """, unsafe_allow_html=True)
1260
+
1261
  # Make the button more clear about its function
1262
  if st.session_state.processed_document_active:
1263
  process_button = st.button("Process Document Again")
 
2077
  # Set processed_document_active to True when a new document is processed
2078
  st.session_state.processed_document_active = True
2079
 
2080
+ # Add global CSS for consistent button styling
2081
  st.markdown("""
2082
  <style>
2083
+ /* Apply to all Streamlit buttons to maintain consistent styling */
2084
+ button[data-testid="baseButton-secondary"],
2085
+ button[data-testid="baseButton-primary"] {
2086
+ opacity: 1 !important;
2087
+ }
2088
+
2089
+ /* Fix for buttons turning white after clicking */
2090
+ .stButton button:active,
2091
+ .stButton button:focus,
2092
+ .stButton button:hover {
2093
+ opacity: 0.8 !important;
2094
+ color: inherit !important;
2095
+ background-color: inherit !important;
2096
+ border-color: inherit !important;
2097
+ }
2098
+
2099
+ /* Close button specific styling */
2100
  .close-button {
2101
+ background-color: #e7e7e7 !important;
2102
+ color: #666 !important;
2103
+ border: none !important;
2104
+ border-radius: 4px !important;
2105
+ padding: 0.25rem 0.5rem !important;
2106
+ font-size: 0.8rem !important;
2107
+ cursor: pointer !important;
2108
+ transition: all 0.2s ease !important;
2109
  }
2110
  .close-button:hover {
2111
+ background-color: #d7d7d7 !important;
2112
+ color: #333 !important;
2113
  }
2114
  </style>
2115
  """, unsafe_allow_html=True)
 
2119
  with success_cols[0]:
2120
  metadata_placeholder.success("**Document processed successfully**")
2121
  with success_cols[1]:
2122
+ # Use a more visually distinctive close button - applying !important to override Streamlit's styles
2123
  st.markdown("""
2124
  <style>
2125
+ /* Style for the Close Document button */
2126
+ div[data-testid="stButton"] button[kind="secondary"] {
2127
+ background-color: #f8f9fa !important;
2128
+ border: 1px solid #dee2e6 !important;
2129
+ padding: 0.25rem 0.5rem !important;
2130
+ font-size: 0.875rem !important;
2131
+ border-radius: 0.2rem !important;
2132
+ color: #333333 !important;
2133
+ }
2134
+
2135
+ /* Maintain styling on hover/focus/active states */
2136
+ div[data-testid="stButton"] button[kind="secondary"]:hover,
2137
+ div[data-testid="stButton"] button[kind="secondary"]:focus,
2138
+ div[data-testid="stButton"] button[kind="secondary"]:active {
2139
+ background-color: #e9ecef !important;
2140
+ border-color: #dee2e6 !important;
2141
+ color: #333333 !important;
2142
  }
2143
  </style>
2144
  """, unsafe_allow_html=True)
 
2403
  if selected_sample > 0:
2404
  selected_url = sample_urls[selected_sample]
2405
 
2406
+ # Add CSS to ensure the Load Sample Document button maintains its styling
2407
+ st.markdown("""
2408
+ <style>
2409
+ /* Ensure primary buttons stay blue even after clicking */
2410
+ button[data-testid="baseButton-primary"] {
2411
+ background-color: rgb(19, 119, 187) !important;
2412
+ color: rgb(255, 255, 255) !important;
2413
+ border-color: rgb(19, 119, 187) !important;
2414
+ }
2415
+
2416
+ /* Maintain styling on hover/focus/active states */
2417
+ button[data-testid="baseButton-primary"]:hover,
2418
+ button[data-testid="baseButton-primary"]:focus,
2419
+ button[data-testid="baseButton-primary"]:active {
2420
+ background-color: rgba(19, 119, 187, 0.8) !important;
2421
+ color: rgb(255, 255, 255) !important;
2422
+ border-color: rgb(19, 119, 187) !important;
2423
+ }
2424
+ </style>
2425
+ """, unsafe_allow_html=True)
2426
+
2427
  # Add process button for the sample document
2428
  if st.button("Load Sample Document"):
2429
  try: