Skip to content

Commit b884838

Browse files
committed
fix(design): modal height, no results screen
1 parent 6ad1848 commit b884838

6 files changed

Lines changed: 73 additions & 13 deletions

File tree

src/NoResultsScreen.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66

77
import { InternalDocSearchHit } from './types';
88

9+
import { NoResultsIcon } from './icons';
10+
911
interface NoResultsScreenProps
1012
extends AutocompleteApi<
1113
InternalDocSearchHit,
@@ -22,6 +24,9 @@ export function NoResultsScreen(props: NoResultsScreenProps) {
2224

2325
return (
2426
<div className="DocSearch-NoResults">
27+
<div className="DocSearch-Screen-Icon">
28+
<NoResultsIcon/>
29+
</div>
2530
<p className="DocSearch-Title">
2631
No results for "<strong>{props.state.query}</strong>".
2732
</p>
@@ -32,9 +37,8 @@ export function NoResultsScreen(props: NoResultsScreenProps) {
3237
{searchSuggestions.slice(0, 3).reduce<React.ReactNode[]>(
3338
(acc, search) => [
3439
...acc,
35-
acc.length > 0 ? ', ' : '',
3640
<button
37-
className="DocSearch-Link"
41+
className="DocSearch-Prefill"
3842
key={search}
3943
onClick={() => {
4044
props.setQuery(search.toLowerCase() + ' ');
@@ -47,14 +51,11 @@ export function NoResultsScreen(props: NoResultsScreenProps) {
4751
],
4852
[]
4953
)}
50-
&nbsp;...
5154
</p>
5255
)}
5356

5457
<p className="DocSearch-Help">
55-
If you believe this query should return results,
56-
<br />
57-
please{' '}
58+
If you believe this query should return results, please{' '}
5859
<a
5960
href="https://github.com/algolia/docsearch-configs/issues/new?template=Missing_results.md"
6061
target="_blank"

src/ResultsScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ export function ResultsScreen(props: ResultsScreenProps) {
4848
>
4949
{item.__docsearch_parent !==
5050
suggestion.items[index + 1]?.__docsearch_parent ? (
51-
<path d="M8 6v42M20 27H8.3"/>
52-
) : (
5351
<path d="M8 6v21M20 27H8.3"/>
52+
) : (
53+
<path d="M8 6v42M20 27H8.3"/>
5454
)}
5555
</g>
5656
</svg>

src/icons/ErrorIcon.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
3+
export function ErrorIcon() {
4+
return (
5+
<svg
6+
width="40"
7+
height="40"
8+
viewBox="0 0 20 20"
9+
fill="none"
10+
fillRule="evenodd"
11+
stroke="currentColor"
12+
strokeLinecap="round"
13+
strokeLinejoin="round" >
14+
<path d="M19 4.8a16 16 0 00-2-1.2m-3.3-1.2A16 16 0 001.1 4.7M16.7 8a12 12 0 00-2.8-1.4M10 6a12 12 0 00-6.7 2M12.3 14.7a4 4 0 00-4.5 0M14.5 11.4A8 8 0 0010 10M3 16L18 2M10 18h0"></path>
15+
</svg>
16+
);
17+
}

src/icons/NoResultsIcon.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
3+
export function NoResultsIcon() {
4+
return (
5+
<svg
6+
width="40"
7+
height="40"
8+
viewBox="0 0 20 20"
9+
fill="none"
10+
fillRule="evenodd"
11+
stroke="currentColor"
12+
strokeLinecap="round"
13+
strokeLinejoin="round" >
14+
<path d="M15.5 4.8c2 3 1.7 7-1 9.7h0l4.3 4.3-4.3-4.3a7.8 7.8 0 01-9.8 1m-2.2-2.2A7.8 7.8 0 0113.2 2.4M2 18L18 2"></path>
15+
</svg>
16+
);
17+
}

src/icons/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ export * from './SearchIcon';
66
export * from './SelectIcon';
77
export * from './SourceIcon';
88
export * from './StarIcon';
9+
export * from './ErrorIcon';
10+
export * from './NoResultsIcon';

src/style.css

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ html[data-theme='dark'] {
8585
--docsearch-key-shadow: inset 0px -2px 0px 0px rgb(40, 45, 85),
8686
inset 0px 0px 1px 1px rgb(81, 87, 125), 0px 2px 2px 0px rgb(3, 4, 9);
8787
--docsearch-footer-background: rgb(30, 33, 54);
88-
--docsearch-footer-shadow: inset 0px 1px 0px 0px rgba(73, 76, 106, 0.52),
89-
0px -4px 8px 0px rgba(0, 0, 0, 0.34);
88+
--docsearch-footer-shadow: inset 0px 1px 0px 0px rgba(73, 76, 106, 0.5),
89+
0px -4px 8px 0px rgba(0, 0, 0, 0.2);
9090
--docsearch-logo-color: #fff;
9191
--docsearch-muted-color: rgb(127, 132, 151);
9292
}
@@ -330,7 +330,7 @@ html[data-theme='dark'] {
330330
/* Modal Dropdown */
331331

332332
.DocSearch-Dropdown {
333-
height: calc(
333+
max-height: calc(
334334
var(--docsearch-modal-height) - var(--docsearch-searchbox-height) -
335335
var(--docsearch-spacing) - var(--docsearch-footer-height)
336336
);
@@ -572,7 +572,7 @@ html[data-theme='dark'] {
572572
}
573573

574574
.DocSearch-Hit-path {
575-
font-size: 0.7em;
575+
font-size: 0.75em;
576576
color: var(--docsearch-muted-color);
577577
}
578578

@@ -584,7 +584,30 @@ html[data-theme='dark'] {
584584
width: 80%;
585585
margin: 0 auto;
586586
text-align: center;
587-
margin-top: 24px;
587+
padding: 24px 0;
588+
font-size: .9em;
589+
}
590+
591+
.DocSearch-Screen-Icon {
592+
color: var(--docsearch-muted-color);
593+
padding-bottom: 12px;
594+
}
595+
596+
.DocSearch-Prefill {
597+
appearance: none;
598+
cursor: pointer;
599+
border: none;
600+
display: inline-block;
601+
border-radius: 1em;
602+
font-size: 0.8em;
603+
background-color: var(--docsearch-muted-color);
604+
margin: 0 4px;
605+
padding: 4px 12px;
606+
}
607+
608+
.DocSearch-Prefill:hover {
609+
outline: none;
610+
background-color: var(--docsearch-primary-color);
588611
}
589612

590613
/* Responsive */

0 commit comments

Comments
 (0)