alexnasa commited on
Commit
d0fe628
·
verified ·
1 Parent(s): 977e52e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +94 -61
app.py CHANGED
@@ -499,15 +499,16 @@ class CameraDropdown(gr.HTML):
499
  }
500
 
501
  function setValue(val, shouldTrigger = false) {
502
- const v = (val ?? "None");
503
- props.value = v;
504
- triggerText.textContent = v;
505
-
506
- items.forEach(btn => {
507
- btn.classList.toggle("selected", btn.dataset.value === v);
508
- });
509
-
510
- if (shouldTrigger) trigger("change", props.value);
 
511
  }
512
 
513
  // Toggle menu
@@ -995,74 +996,106 @@ css += """
995
  }
996
 
997
  /* 4) Ensure menu overlays neighbors and isn't clipped */
 
998
  .cd-menu{
999
- position: absolute;
1000
- top: calc(100% + 10px);
1001
- left: 0;
1002
-
1003
- min-width: 240px;
1004
- background: #2b2b2b;
1005
- border: 1px solid rgba(255,255,255,0.14);
1006
- border-radius: 14px;
1007
- box-shadow: 0 18px 40px rgba(0,0,0,0.35);
1008
- padding: 10px;
1009
-
1010
- opacity: 0;
1011
- transform: translateY(-6px);
1012
- pointer-events: none;
1013
- transition: opacity 160ms ease, transform 160ms ease;
1014
-
1015
- z-index: 9999; /* was 50 */
1016
- }
1017
-
1018
- .cd-menu.open{
1019
- opacity: 1;
1020
- transform: translateY(0);
1021
- pointer-events: auto;
1022
  }
1023
 
1024
  .cd-title{
1025
- padding: 6px 8px 10px 8px;
1026
- font-size: 12px;
1027
- font-weight: 800;
1028
- letter-spacing: 0.02em;
1029
- color: rgba(255,255,255,0.55);
1030
- text-transform: none;
 
 
 
1031
  }
1032
-
 
 
 
 
 
 
 
1033
  .cd-items{
1034
- display: flex;
1035
- flex-direction: column;
1036
- gap: 6px;
1037
  }
1038
-
 
1039
  .cd-item{
1040
- width: 100%;
1041
- text-align: left;
1042
- border: none;
1043
- background: rgba(255,255,255,0.06);
1044
- color: rgba(255,255,255,0.92);
1045
- padding: 10px 10px;
1046
- border-radius: 12px;
1047
- cursor: pointer;
1048
- font-size: 14px;
1049
- font-weight: 700;
1050
- transition: background 120ms ease, transform 80ms ease;
 
 
 
1051
  }
1052
-
 
1053
  .cd-item:hover{
1054
- background: rgba(255,255,255,0.10);
1055
  }
1056
-
1057
- .cd-item:active{
1058
- transform: translateY(1px);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1059
  }
1060
 
 
 
1061
  .cd-item.selected{
1062
- background: rgba(139,255,151,0.22);
1063
- border: 1px solid rgba(139,255,151,0.35);
1064
  }
1065
 
 
1066
  """
1067
 
1068
 
 
499
  }
500
 
501
  function setValue(val, shouldTrigger = false) {
502
+ const v = (val ?? "None");
503
+ props.value = v;
504
+ triggerText.textContent = v;
505
+
506
+ // mark selected (for CSS tick)
507
+ items.forEach(btn => {
508
+ btn.dataset.selected = (btn.dataset.value === v) ? "true" : "false";
509
+ });
510
+
511
+ if (shouldTrigger) trigger("change", props.value);
512
  }
513
 
514
  // Toggle menu
 
996
  }
997
 
998
  /* 4) Ensure menu overlays neighbors and isn't clipped */
999
+ /* Move dropdown a tiny bit up (closer to the trigger) */
1000
  .cd-menu{
1001
+ position: absolute;
1002
+ top: calc(100% + 4px); /* was +10px */
1003
+ left: 0;
1004
+
1005
+ min-width: 240px;
1006
+ background: #2b2b2b;
1007
+ border: 1px solid rgba(255,255,255,0.14);
1008
+ border-radius: 14px;
1009
+ box-shadow: 0 18px 40px rgba(0,0,0,0.35);
1010
+ padding: 10px;
1011
+
1012
+ opacity: 0;
1013
+ transform: translateY(-6px);
1014
+ pointer-events: none;
1015
+ transition: opacity 160ms ease, transform 160ms ease;
1016
+
1017
+ z-index: 9999;
 
 
 
 
 
 
1018
  }
1019
 
1020
  .cd-title{
1021
+ font-size: 12px;
1022
+ font-weight: 600;
1023
+ text-transform: uppercase;
1024
+ letter-spacing: 0.04em;
1025
+
1026
+ color: rgba(255,255,255,0.45); /* 👈 muted grey */
1027
+ margin-bottom: 6px;
1028
+ padding: 0 6px;
1029
+ pointer-events: none; /* title is non-interactive */
1030
  }
1031
+
1032
+
1033
+ .cd-menu.open{
1034
+ opacity: 1;
1035
+ transform: translateY(0);
1036
+ pointer-events: auto;
1037
+ }
1038
+
1039
  .cd-items{
1040
+ display: flex;
1041
+ flex-direction: column;
1042
+ gap: 0px; /* tighter, more like a native menu */
1043
  }
1044
+
1045
+ /* Items: NO "boxed" buttons by default */
1046
  .cd-item{
1047
+ width: 100%;
1048
+ text-align: left;
1049
+ border: none;
1050
+ background: transparent; /* ✅ removes box look */
1051
+ color: rgba(255,255,255,0.92);
1052
+ padding: 8px 34px 8px 12px; /* right padding leaves room for tick */
1053
+ border-radius: 10px; /* only matters on hover */
1054
+ cursor: pointer;
1055
+
1056
+ font-size: 14px;
1057
+ font-weight: 700;
1058
+
1059
+ position: relative;
1060
+ transition: background 120ms ease;
1061
  }
1062
+
1063
+ /* “Box effect” only on hover (not always) */
1064
  .cd-item:hover{
1065
+ background: rgba(255,255,255,0.08);
1066
  }
1067
+
1068
+ /* Tick on the right ONLY on hover */
1069
+ .cd-item::after{
1070
+ content: "✓";
1071
+ position: absolute;
1072
+ right: 12px;
1073
+ top: 50%;
1074
+ transform: translateY(-50%);
1075
+ opacity: 0; /* hidden by default */
1076
+ transition: opacity 120ms ease;
1077
+ color: rgba(255,255,255,0.9);
1078
+ font-weight: 900;
1079
+ }
1080
+
1081
+ /* show tick ONLY for selected item */
1082
+ .cd-item[data-selected="true"]::after{
1083
+ opacity: 1;
1084
+ }
1085
+
1086
+ /* keep hover box effect, but no tick change */
1087
+ .cd-item:hover{
1088
+ background: rgba(255,255,255,0.08);
1089
  }
1090
 
1091
+
1092
+ /* Kill any old “selected” styling just in case */
1093
  .cd-item.selected{
1094
+ background: transparent !important;
1095
+ border: none !important;
1096
  }
1097
 
1098
+
1099
  """
1100
 
1101