Skip to content

Commit 1fc3907

Browse files
authored
Fix UI issues (#1464)
1. Toggle the docs menu conditionally to avoid showing empty white space when the menu is not present. <img width="752" alt="Screenshot 2025-05-02 at 10 41 07 AM" src="https://github.com/user-attachments/assets/5d39502b-566b-4488-b94c-33347456d4d1" /> 2. Fix padding and layout shift when pasting into the search input field. <img width="752" alt="Screenshot 2025-05-02 at 10 42 28 AM" src="https://github.com/user-attachments/assets/454621c7-1639-44f7-894e-668c6d45a6ea" />
1 parent d48cb3e commit 1fc3907

File tree

3 files changed

+38
-23
lines changed

3 files changed

+38
-23
lines changed

source/_static/scss/includes/_search.scss

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
.header {
44
.search__dropdown {
55
position: absolute;
6-
top: 100%;
7-
left: 0;
8-
width: 100%;
6+
top: calc(100% - 1rem);
7+
left: 0.1rem;
8+
width: calc(100% - 0.2rem);
99
}
1010

1111
.search--focused {
@@ -71,6 +71,11 @@
7171
.search__reset {
7272
display: grid;
7373
}
74+
75+
#search-box {
76+
position: relative;
77+
z-index: 11;
78+
}
7479
}
7580

7681
.search__form {
@@ -105,7 +110,9 @@
105110
border-radius: $border-radius;
106111
cursor: pointer;
107112
display: none;
108-
margin-right: 0.75rem;
113+
position: absolute;
114+
right: 0.75rem;
115+
top: 0.6rem;
109116

110117
&:focus,
111118
&:hover {
@@ -127,7 +134,7 @@
127134
}
128135

129136
.search__powered-by {
130-
padding: 0.6rem 1rem;
137+
padding: 0.3rem 0.7rem;
131138
display: inline-flex;
132139
align-items: center;
133140
color: var(--text-muted-color);
@@ -190,7 +197,7 @@
190197
border: 1px solid var(--is-refine-list-border-color);
191198
border-radius: $border-radius;
192199
line-height: 100%;
193-
padding: 0.35rem 0.5rem;
200+
padding: 0.35rem 0.6rem;
194201
font-weight: $font-weight-medium;
195202
font-size: $font-size-xs;
196203
}
@@ -217,6 +224,7 @@
217224
.search__hits__list {
218225
list-style: none;
219226
margin: 0;
227+
padding: 0;
220228
text-align: left;
221229
}
222230

@@ -234,6 +242,10 @@
234242
&:focus,
235243
&:hover {
236244
background-color: var(--is-highlight-color);
245+
246+
.search__hits__icon {
247+
background-color: $white;
248+
}
237249
}
238250
}
239251
}
@@ -292,7 +304,7 @@
292304
flex-shrink: 0;
293305
margin-right: 0.75rem;
294306
border-radius: $border-radius;
295-
background-color: var(--is-search-bg);
307+
background-color: var(--theme-light-bg);
296308
display: grid;
297309
fill: var(--text-muted-color);
298310
place-content: center;
@@ -312,13 +324,13 @@
312324

313325

314326
.search__hits--empty {
315-
display: grid;
316-
place-content: center;
327+
margin: 0;
328+
padding: 0;
317329
text-align: center;
318330
font-size: $font-size-sm;
319331
color: var(--text-muted-color);
320332

321-
svg {
333+
& > svg {
322334
margin-bottom: 1rem;
323335
}
324336

@@ -403,6 +415,7 @@
403415
flex-direction: column;
404416
border-radius: $border-radius-lg;
405417
display: none;
418+
padding-top: 1.5rem;
406419
max-height: 24.5rem;
407420
box-shadow: 0px 7px 10px #00000036;
408421
}
@@ -431,7 +444,7 @@
431444
}
432445

433446
.search__hits__list {
434-
padding: 1rem;
447+
padding: 0.75rem;
435448
}
436449
}
437450

source/_static/scss/includes/_theme.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ $theme-properties: (
5555
--docs-nav-group-border-color: $light-300 $dark-300,
5656

5757
// Scrollbar
58-
--scrollbar-bg: $light-500 $dark-200,
59-
--scrollbar-hover-bg: darken($light-500, 5%) $dark-300,
58+
--scrollbar-bg: $light-300 $dark-200,
59+
--scrollbar-hover-bg: $light-400 $dark-300,
6060

6161
// Table
6262
--table-border-color: $light-300 $dark-200,
@@ -120,7 +120,7 @@ $theme-properties: (
120120
// Search
121121
--is-dropdown-bg: #edf1f3 #1c232d,
122122
--is-container-background: rgba($black, 0.25) rgba(16, 21, 28, 0.851),
123-
--is-highlight-color: rgba(120, 133, 152, 0.125) rgba(16, 21, 28, 0.3),
123+
--is-highlight-color: $light-100 rgba(16, 21, 28, 0.3),
124124
--is-search-focus-shadow: rgba($white, 0.15) #1b232f,
125125
--is-hit-icon-color: $black $light-500,
126126
--is-search-bg: $white $dark-100,

source/_templates/header.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@
2828

2929
<h2 class="header__title hidden-rm">Documentation</h2>
3030

31-
<div class="docs-menu-wrapper overflow-x-auto hide-scrollbar mb-20 text-center">
32-
<nav class="docs-menu bg-white/75 inline-flex items-center rounded-lg font-heading border p-0.5 border-theme-neutral-subtle">
33-
{% for doc in docs %}
34-
{% set current_name = doc.name if doc.current == True %}
35-
<a target="{% if doc.external == True %}_blank{% endif %}" class="{% if doc.current == True %}active{% endif %} flex-1 rounded-md shrink-0 h-14 border border-transparent font-bold transition-all duration-300 hover:text-theme-red [&.active]:text-theme-red [&.active]:border-theme-red" href="{{ doc.url }}">
31+
{% if docs %}
32+
<div class="docs-menu-wrapper overflow-x-auto hide-scrollbar mb-20 text-center">
33+
<nav class="docs-menu bg-white/75 inline-flex items-center rounded-lg font-heading border p-0.5 border-theme-neutral-subtle">
34+
{% for doc in docs %}
35+
{% set current_name = doc.name if doc.current == True %}
36+
<a target="{% if doc.external == True %}_blank{% endif %}" class="{% if doc.current == True %}active{% endif %} flex-1 rounded-md shrink-0 h-14 border border-transparent font-bold transition-all duration-300 hover:text-theme-red [&.active]:text-theme-red [&.active]:border-theme-red" href="{{ doc.url }}">
3637
{{ doc.name }}
37-
</a>
38-
{% endfor %}
39-
</nav>
40-
</div>
38+
</a>
39+
{% endfor %}
40+
</nav>
41+
</div>
42+
{% endif %}
4143

4244
{%- include "platform-navigation.html" %}
4345

0 commit comments

Comments
 (0)