Gaston commited on
Commit
4da15f5
·
1 Parent(s): 4ad759d

up app.py -> styles -> error to upload img

Browse files
Files changed (1) hide show
  1. app.py +12 -46
app.py CHANGED
@@ -807,13 +807,8 @@ def inject_custom_css():
807
  """
808
  Inyecta CSS personalizado para:
809
  - Fijar el ancho del sidebar a 300px
810
- - Eliminar el rebote/temblor del contenido principal
811
- - Optimizar el layout responsivo
812
-
813
- Comportamiento:
814
- - Sidebar: ancho fijo de 300px con scroll
815
- - Contenido principal: scroll estable sin cambios de ancho
816
- - Sin rebotes causados por scrollbar
817
  """
818
  st.markdown("""
819
  <style>
@@ -828,30 +823,19 @@ def inject_custom_css():
828
  max-width: 300px !important;
829
  }
830
 
831
- /* Contenedor interno del sidebar */
832
  section[data-testid="stSidebar"] > div:first-child {
833
  width: 300px !important;
834
  min-width: 300px !important;
835
  max-width: 300px !important;
836
  }
837
 
838
- /* Contenido del sidebar con scroll suave */
839
- section[data-testid="stSidebar"] .block-container {
840
- padding-left: 1rem !important;
841
- padding-right: 1rem !important;
842
- overflow-y: auto !important;
843
- overflow-x: hidden !important;
844
- }
845
-
846
  /* ========================================
847
  CONTENIDO PRINCIPAL - Sin rebotes
848
  ======================================== */
849
 
850
- /* Área principal con margen fijo del sidebar */
851
  section[data-testid="stMain"] {
852
  margin-left: 300px !important;
853
- overflow-y: auto !important;
854
- overflow-x: hidden !important;
855
  }
856
 
857
  /* Contenedor principal - scroll estable */
@@ -859,35 +843,35 @@ def inject_custom_css():
859
  padding-left: 2rem !important;
860
  padding-right: 2rem !important;
861
  max-width: 100% !important;
862
- overflow-x: hidden !important;
863
  }
864
 
865
  /* ========================================
866
- PREVENCIÓN DE REBOTES
867
  ======================================== */
868
 
869
- /* Forzar scrollbar siempre visible para evitar saltos */
870
- section[data-testid="stMain"] {
871
- scrollbar-gutter: stable !important;
 
 
 
872
  }
873
 
874
- /* Imágenes responsivas sin overflow */
875
  .main img {
876
  max-width: 100% !important;
877
  height: auto !important;
878
  }
879
 
880
- /* Figuras matplotlib sin overflow */
881
  .main .stpyplot {
882
  max-width: 100% !important;
883
- overflow: hidden !important;
884
  }
885
 
886
  /* ========================================
887
  RESPONSIVE - Mobile
888
  ======================================== */
889
 
890
- /* En pantallas pequeñas, reducir sidebar */
891
  @media (max-width: 768px) {
892
  section[data-testid="stSidebar"] {
893
  width: 250px !important;
@@ -900,7 +884,6 @@ def inject_custom_css():
900
  }
901
  }
902
 
903
- /* En pantallas muy pequeñas, sidebar colapsable */
904
  @media (max-width: 576px) {
905
  section[data-testid="stSidebar"] {
906
  width: 0px !important;
@@ -911,25 +894,8 @@ def inject_custom_css():
911
  margin-left: 0px !important;
912
  }
913
  }
914
-
915
- /* ========================================
916
- OPTIMIZACIONES VISUALES
917
- ======================================== */
918
-
919
- /* Suavizar transiciones */
920
- section[data-testid="stSidebar"],
921
- section[data-testid="stMain"] {
922
- transition: width 0.3s ease, margin-left 0.3s ease !important;
923
- }
924
-
925
- /* Mejorar legibilidad */
926
- .main {
927
- font-smooth: antialiased !important;
928
- -webkit-font-smoothing: antialiased !important;
929
- }
930
  </style>
931
  """, unsafe_allow_html=True)
932
-
933
  # ===================================================================
934
  # SIDEBAR
935
  # ===================================================================
 
807
  """
808
  Inyecta CSS personalizado para:
809
  - Fijar el ancho del sidebar a 300px
810
+ - Eliminar el rebote del contenido
811
+ - NO interferir con file uploader
 
 
 
 
 
812
  """
813
  st.markdown("""
814
  <style>
 
823
  max-width: 300px !important;
824
  }
825
 
 
826
  section[data-testid="stSidebar"] > div:first-child {
827
  width: 300px !important;
828
  min-width: 300px !important;
829
  max-width: 300px !important;
830
  }
831
 
 
 
 
 
 
 
 
 
832
  /* ========================================
833
  CONTENIDO PRINCIPAL - Sin rebotes
834
  ======================================== */
835
 
836
+ /* Área principal con margen fijo */
837
  section[data-testid="stMain"] {
838
  margin-left: 300px !important;
 
 
839
  }
840
 
841
  /* Contenedor principal - scroll estable */
 
843
  padding-left: 2rem !important;
844
  padding-right: 2rem !important;
845
  max-width: 100% !important;
 
846
  }
847
 
848
  /* ========================================
849
+ PREVENCIÓN DE REBOTES (SIN BLOQUEAR UPLOADER)
850
  ======================================== */
851
 
852
+ /* NO usar overflow: hidden en main - rompe file uploader */
853
+ /* Usar scrollbar-gutter solo si el navegador lo soporta */
854
+ @supports (scrollbar-gutter: stable) {
855
+ section[data-testid="stMain"] {
856
+ scrollbar-gutter: stable;
857
+ }
858
  }
859
 
860
+ /* Imágenes responsivas */
861
  .main img {
862
  max-width: 100% !important;
863
  height: auto !important;
864
  }
865
 
866
+ /* Figuras matplotlib */
867
  .main .stpyplot {
868
  max-width: 100% !important;
 
869
  }
870
 
871
  /* ========================================
872
  RESPONSIVE - Mobile
873
  ======================================== */
874
 
 
875
  @media (max-width: 768px) {
876
  section[data-testid="stSidebar"] {
877
  width: 250px !important;
 
884
  }
885
  }
886
 
 
887
  @media (max-width: 576px) {
888
  section[data-testid="stSidebar"] {
889
  width: 0px !important;
 
894
  margin-left: 0px !important;
895
  }
896
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
897
  </style>
898
  """, unsafe_allow_html=True)
 
899
  # ===================================================================
900
  # SIDEBAR
901
  # ===================================================================