Amber Tanaka commited on
Commit
9c18850
·
unverified ·
1 Parent(s): 9832707

Little arrow button to take you back up (#24)

Browse files
Files changed (2) hide show
  1. content.py +20 -1
  2. ui_components.py +9 -2
content.py CHANGED
@@ -407,6 +407,26 @@ span.wrap[tabindex="0"][role="button"][data-editable="false"] {
407
  grid-row: 2 !important;
408
  grid-column: 1 / -1 !important;
409
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  /*------ Submission Page CSS ------*/
411
  #custom-form-group {
412
  border: 1px solid #000 !important;
@@ -432,5 +452,4 @@ span.wrap[tabindex="0"][role="button"][data-editable="false"] {
432
  .styler {
433
  background: none;
434
  }
435
-
436
  """
 
407
  grid-row: 2 !important;
408
  grid-column: 1 / -1 !important;
409
  }
410
+ .benchmark-header {
411
+ display: flex !important;
412
+ align-items: center !important;
413
+ gap: 20px !important;
414
+ }
415
+ #scroll-up-button {
416
+ flex-grow: 0;
417
+ display: flex;
418
+ color: #032629;
419
+ background-color: #faf2e9;
420
+ align-items: flex-end;
421
+ height: 57px;
422
+ padding: 0px;
423
+ padding-bottom: 2px;
424
+ min-width: 50px;
425
+ }
426
+ .dark #scroll-up-button {
427
+ color: #faf2e9;
428
+ background-color: #032629;
429
+ }
430
  /*------ Submission Page CSS ------*/
431
  #custom-form-group {
432
  border: 1px solid #000 !important;
 
452
  .styler {
453
  background: none;
454
  }
 
455
  """
ui_components.py CHANGED
@@ -375,10 +375,17 @@ def create_benchmark_details_display(
375
 
376
  gr.Markdown("---")
377
  gr.Markdown("## Detailed Benchmark Results")
378
-
379
  # 2. Loop through each benchmark and create its UI components
380
  for benchmark_name in benchmark_names:
381
- gr.Markdown(f"### {benchmark_name} Leaderboard", header_links=True)
 
 
 
 
 
 
 
382
 
383
  # 3. Prepare the data for this specific benchmark's table and plot
384
  benchmark_score_col = f"{benchmark_name} Score"
 
375
 
376
  gr.Markdown("---")
377
  gr.Markdown("## Detailed Benchmark Results")
378
+ scroll_to_top_js = "() => { window.scrollTo({top: 0, behavior: 'smooth'}); }"
379
  # 2. Loop through each benchmark and create its UI components
380
  for benchmark_name in benchmark_names:
381
+ with gr.Row(elem_classes=["benchmark-header"]):
382
+ gr.Markdown(f"### {benchmark_name} Leaderboard", header_links=True)
383
+ scroll_up_button = gr.Button(
384
+ value="⬆",
385
+ elem_id="scroll-up-button",
386
+ )
387
+ # When the button is clicked, it runs our JavaScript function. No Python needed.
388
+ scroll_up_button.click(fn=None, js=scroll_to_top_js)
389
 
390
  # 3. Prepare the data for this specific benchmark's table and plot
391
  benchmark_score_col = f"{benchmark_name} Score"