techfreakworm commited on
Commit
77d7353
·
unverified ·
1 Parent(s): 09bd6f1

fix(ui): mobile sidebar — compact tab pills, kill dead vertical chrome

Browse files

The previous mobile media query set the sidebar to flex-direction:row
and overflow-x:auto, but each radio label still had width:100% from
the desktop styles. So the strip rendered with each label consuming
the full container width, defeating the row layout and stacking
vertically anyway.

Plus the sidebar block still kept its desktop border + padding, so on
a 360 px viewport the dead chrome took ~400 px of vertical space
before the form even started — pushing the Generate button below
the fold.

This fix at < 640 px:
- Strip the sidebar's border + background + radius; it now reads as a
plain tab strip, not a boxed sidebar.
- Override label width to auto / max-content so each option is only as
wide as its emoji + label, allowing several to sit side-by-side.
- flex-direction:row + flex:0 0 auto + nowrap on the label so flexbox
doesn't grow them.
- overflow-x:auto + scrollbar-width:none on .wrap so if the strip ever
exceeds the viewport it scrolls instead of growing the page width.
- Tighten the header / CTA / content padding for the small viewport.

Result on 360 x 800: brand + CTA + 5 tab pills (2 rows since all 5 fit
at that width) + form + Generate button + output + metadata all
reachable without unreasonable scroll. History block stays hidden via
the existing display:none.

Files changed (1) hide show
  1. theme.py +49 -8
theme.py CHANGED
@@ -231,36 +231,77 @@ footer {{ display:none !important; }}
231
 
232
  /* === Responsive: mobile < 640 px ======================================= */
233
  @media (max-width: 640px) {{
 
234
  .ams-body {{
235
  flex-direction:column !important;
 
236
  }}
 
 
 
237
  .ams-sidebar {{
238
  min-width:100% !important;
239
  max-width:100% !important;
240
- padding:6px !important;
 
 
 
 
 
 
 
 
 
 
241
  }}
242
- /* Mobile: switch sidebar to horizontal scroll strip */
 
 
 
 
243
  .ams-side-radio .wrap {{
244
  flex-direction:row !important;
245
  overflow-x:auto !important;
 
246
  gap:4px !important;
 
 
 
 
 
 
247
  }}
 
248
  .ams-side-radio label {{
 
 
 
 
 
249
  font-size:11px !important;
250
  white-space:nowrap !important;
 
 
251
  border-left:none !important;
252
  border-bottom:2px solid transparent !important;
253
- padding:8px 10px !important;
254
- justify-content:flex-start !important;
255
- }}
256
- .ams-side-radio label::first-letter {{
257
- font-size:13px !important;
258
  }}
 
259
  .ams-side-radio label:has(input[type="radio"]:checked) {{
260
  border-left-color:transparent !important;
261
  border-bottom-color:{PRIMARY} !important;
 
262
  }}
 
 
 
263
  .ams-history {{ display:none !important; }}
264
- .ams-cta {{ font-size:11px; }}
 
 
 
 
 
265
  }}
266
  """
 
231
 
232
  /* === Responsive: mobile < 640 px ======================================= */
233
  @media (max-width: 640px) {{
234
+ /* Stack body so sidebar (now a tab strip) sits above content */
235
  .ams-body {{
236
  flex-direction:column !important;
237
+ gap:8px !important;
238
  }}
239
+
240
+ /* Sidebar = horizontal scroll strip. Strip its desktop chrome
241
+ (border, large padding, fixed width) so it reads as a tab bar. */
242
  .ams-sidebar {{
243
  min-width:100% !important;
244
  max-width:100% !important;
245
+ padding:2px !important;
246
+ border:none !important;
247
+ background:transparent !important;
248
+ border-radius:0 !important;
249
+ }}
250
+
251
+ /* The radio's outer block (gr.Radio with container=False still gets
252
+ padding from Gradio's base styles). Flatten it. */
253
+ .ams-side-radio {{
254
+ padding:0 !important;
255
+ background:transparent !important;
256
  }}
257
+
258
+ /* Real options live in the second .wrap (Gradio renders an extra
259
+ hidden one first); both flex-row + overflow + nowrap.
260
+ CRITICAL: override the desktop label width:100% — that's what
261
+ makes labels stack vertically inside a flex-row container. */
262
  .ams-side-radio .wrap {{
263
  flex-direction:row !important;
264
  overflow-x:auto !important;
265
+ overflow-y:hidden !important;
266
  gap:4px !important;
267
+ padding-bottom:2px !important;
268
+ /* Hide scrollbar but keep scrolling */
269
+ scrollbar-width:none !important;
270
+ }}
271
+ .ams-side-radio .wrap::-webkit-scrollbar {{
272
+ display:none !important;
273
  }}
274
+
275
  .ams-side-radio label {{
276
+ /* Compact pill: just enough room for emoji + label, no flex-grow */
277
+ width:auto !important;
278
+ min-width:0 !important;
279
+ max-width:max-content !important;
280
+ flex:0 0 auto !important;
281
  font-size:11px !important;
282
  white-space:nowrap !important;
283
+ padding:7px 11px !important;
284
+ /* Bottom border instead of left border for the horizontal context */
285
  border-left:none !important;
286
  border-bottom:2px solid transparent !important;
287
+ border-radius:4px !important;
288
+ justify-content:center !important;
 
 
 
289
  }}
290
+ .ams-side-radio label.selected,
291
  .ams-side-radio label:has(input[type="radio"]:checked) {{
292
  border-left-color:transparent !important;
293
  border-bottom-color:{PRIMARY} !important;
294
+ background:{HOVER_BG} !important;
295
  }}
296
+
297
+ /* History block off-screen on mobile (already display:none on tablet+;
298
+ restate here in case the cascade gets weird) */
299
  .ams-history {{ display:none !important; }}
300
+
301
+ /* Tighter chrome */
302
+ .ams-header {{ padding:6px 2px 2px 2px !important; }}
303
+ .ams-brand {{ font-size:15px !important; }}
304
+ .ams-cta {{ font-size:11px !important; padding-bottom:8px !important; margin-bottom:8px !important; }}
305
+ .ams-content {{ padding:12px !important; }}
306
  }}
307
  """