tfrere HF Staff commited on
Commit
6c9bb4f
·
1 Parent(s): e903a32

fix inline glossary issues

Browse files
app/src/components/Tenet.astro CHANGED
@@ -55,15 +55,13 @@ const tooltipId = `tenet-${Math.random().toString(36).slice(2)}`;
55
  onmouseenter={`window.showTenetTooltip(event, '${tooltipId}')`}
56
  onmousemove={`window.updateTenetTooltip(event, '${tooltipId}')`}
57
  onmouseleave={`window.hideTenetTooltip('${tooltipId}')`}
58
- >{display}</span>
59
-
60
- <div id={tooltipId} class="glossary-tooltip" data-position={position}>
61
- <div class="glossary-tooltip__content">
62
- <div class="glossary-tooltip__term">{term}</div>
63
- <div class="glossary-tooltip__definition">{definition}</div>
64
- </div>
65
- <div class="glossary-tooltip__arrow"></div>
66
- </div>
67
 
68
  <script is:inline>
69
  if (!window.tenetTooltipInitialized) {
@@ -72,16 +70,23 @@ if (!window.tenetTooltipInitialized) {
72
  window.showTenetTooltip = function(event, id) {
73
  const tooltip = document.getElementById(id);
74
  if (!tooltip) return;
75
- tooltip.style.display = 'block';
76
  tooltip.style.opacity = '1';
77
  tooltip.style.top = (event.clientY + 10) + 'px';
78
  tooltip.style.left = (event.clientX + 10) + 'px';
79
  };
80
 
 
 
 
 
 
 
 
81
  window.hideTenetTooltip = function(id) {
82
  const tooltip = document.getElementById(id);
83
  if (!tooltip) return;
84
- tooltip.style.display = 'none';
85
  tooltip.style.opacity = '0';
86
  };
87
  }
 
55
  onmouseenter={`window.showTenetTooltip(event, '${tooltipId}')`}
56
  onmousemove={`window.updateTenetTooltip(event, '${tooltipId}')`}
57
  onmouseleave={`window.hideTenetTooltip('${tooltipId}')`}
58
+ >{display}</span><span id={tooltipId} class="glossary-tooltip" data-position={position}>
59
+ <span class="glossary-tooltip__content">
60
+ <span class="glossary-tooltip__term">{term}</span>
61
+ <span class="glossary-tooltip__definition">{definition}</span>
62
+ </span>
63
+ <span class="glossary-tooltip__arrow"></span>
64
+ </span>
 
 
65
 
66
  <script is:inline>
67
  if (!window.tenetTooltipInitialized) {
 
70
  window.showTenetTooltip = function(event, id) {
71
  const tooltip = document.getElementById(id);
72
  if (!tooltip) return;
73
+ tooltip.style.visibility = 'visible';
74
  tooltip.style.opacity = '1';
75
  tooltip.style.top = (event.clientY + 10) + 'px';
76
  tooltip.style.left = (event.clientX + 10) + 'px';
77
  };
78
 
79
+ window.updateTenetTooltip = function(event, id) {
80
+ const tooltip = document.getElementById(id);
81
+ if (!tooltip) return;
82
+ tooltip.style.top = (event.clientY + 10) + 'px';
83
+ tooltip.style.left = (event.clientX + 10) + 'px';
84
+ };
85
+
86
  window.hideTenetTooltip = function(id) {
87
  const tooltip = document.getElementById(id);
88
  if (!tooltip) return;
89
+ tooltip.style.visibility = 'hidden';
90
  tooltip.style.opacity = '0';
91
  };
92
  }
app/src/styles/components/_glossary.css CHANGED
@@ -42,15 +42,18 @@
42
  pointer-events: none;
43
  max-width: 300px;
44
  min-width: 200px;
 
45
  }
46
 
47
  .glossary-tooltip.is-visible {
 
48
  opacity: 1;
49
  transform: translateY(0);
50
  pointer-events: auto;
51
  }
52
 
53
  .glossary-tooltip__content {
 
54
  background: var(--surface-bg);
55
  border: 1px solid var(--border-color);
56
  border-radius: 8px;
@@ -60,6 +63,7 @@
60
  }
61
 
62
  .glossary-tooltip__term {
 
63
  font-weight: 600;
64
  font-size: 14px;
65
  color: var(--primary-color);
@@ -68,6 +72,7 @@
68
  }
69
 
70
  .glossary-tooltip__definition {
 
71
  font-size: 13px;
72
  color: var(--text-color);
73
  line-height: 1.4;
@@ -75,6 +80,7 @@
75
  }
76
 
77
  .glossary-tooltip__arrow {
 
78
  position: absolute;
79
  width: 0;
80
  height: 0;
 
42
  pointer-events: none;
43
  max-width: 300px;
44
  min-width: 200px;
45
+ visibility: hidden;
46
  }
47
 
48
  .glossary-tooltip.is-visible {
49
+ visibility: visible;
50
  opacity: 1;
51
  transform: translateY(0);
52
  pointer-events: auto;
53
  }
54
 
55
  .glossary-tooltip__content {
56
+ display: block;
57
  background: var(--surface-bg);
58
  border: 1px solid var(--border-color);
59
  border-radius: 8px;
 
63
  }
64
 
65
  .glossary-tooltip__term {
66
+ display: block;
67
  font-weight: 600;
68
  font-size: 14px;
69
  color: var(--primary-color);
 
72
  }
73
 
74
  .glossary-tooltip__definition {
75
+ display: block;
76
  font-size: 13px;
77
  color: var(--text-color);
78
  line-height: 1.4;
 
80
  }
81
 
82
  .glossary-tooltip__arrow {
83
+ display: block;
84
  position: absolute;
85
  width: 0;
86
  height: 0;