Skip to content

Commit dd9f175

Browse files
authored
Search completion widget style updates. (#8204)
1 parent 4229317 commit dd9f175

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

pkg/web_app/lib/src/widget/completion/suggest.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ class Suggestion {
110110
final overlap = _lcs(prefix, option);
111111
var html = option;
112112
if (overlap.isNotEmpty) {
113-
html = html.replaceAll(overlap, '<strong>$overlap</strong>');
113+
html = html.replaceAll(
114+
overlap, '<span class="completion-overlap">$overlap</span>');
114115
}
115116
final score = (option.startsWith(word) ? math.pow(overlap.length, 3) : 0) +
116117
math.pow(overlap.length, 2) +

pkg/web_app/test/widget/completion/suggest_test.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,22 @@ void main() {
6868
'start': 0,
6969
'end': 5,
7070
'value': 'is:flutter-favorite ',
71-
'html': 'flu<strong>tt</strong>er-favorite',
71+
'html': 'flu<span class="completion-overlap">tt</span>er-favorite',
7272
'score': 4.125,
7373
},
7474
{
7575
'start': 0,
7676
'end': 5,
7777
'value': 'is:unlisted ',
78-
'html': 'unlis<strong>t</strong>ed',
78+
'html': 'unlis<span class="completion-overlap">t</span>ed',
7979
'score': 1.125,
8080
},
8181
{
8282
'start': 0,
8383
'end': 5,
8484
'value': 'is:dart3-compatible ',
85-
'html': 'dar<strong>t</strong>3-compa<strong>t</strong>ible',
85+
'html':
86+
'dar<span class="completion-overlap">t</span>3-compa<span class="completion-overlap">t</span>ible',
8687
'score': 1.0625,
8788
},
8889
{

pkg/web_css/lib/src/_search.scss

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,15 @@
110110
overflow-x: hidden;
111111
appearance: none;
112112
width: 25ex;
113-
border: 1px solid #000;
113+
padding-bottom: 4px;
114+
border-left: 1px solid #000;
115+
border-right: 1px solid #000;
116+
border-bottom: 1px solid #000;
117+
border-bottom-left-radius: 5px;
118+
border-bottom-right-radius: 5px;
114119
max-height: 20em;
115-
background-color: var(--pub-neutral-bgColor);
120+
background: var(--pub-searchbar_input-background-color);
121+
color: var(--pub-input-placeholder-color);
116122
font-size: 16px;
117123
margin-left: 48px; // counter padding-left on .search-bar>.input
118124
margin-top: -14px; // counter padding-top on .search-bar>.input
@@ -123,11 +129,16 @@
123129
padding: 0px 3px;
124130

125131
&:hover {
126-
background-color: var(--pub-selected-bgColor);
132+
background-color: var(--pub-searchbar_input_hover-background-color);
133+
}
134+
135+
.completion-overlap {
136+
color: var(--pub-searchbar_input-text-color);
137+
font-weight: 500; // slightly bolder
127138
}
128139
}
129140

130141
>.completion-option-selected {
131-
background-color: var(--pub-selected-bgColor);
142+
background-color: var(--pub-searchbar_input_hover-background-color);
132143
}
133144
}

pkg/web_css/lib/src/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
--pub-searchbar-background-color: #132030;
8080
--pub-searchbar-text-color: #8d9399;
8181
--pub-searchbar_input-background-color: #35404d;
82+
--pub-searchbar_input_hover-background-color: #455060;
8283
--pub-searchbar_input-text-color: var(--pub-color-white);
8384
--pub-session_warning-background-color: #ffffaa;
8485
--pub-site_header_banner-background-color: #1C2834;

0 commit comments

Comments
 (0)