fix(design): improvements from feedbacks
- No results - Select Icon - Start screen message
This commit is contained in:
parent
3513478fb6
commit
c9273bfbca
4 changed files with 71 additions and 39 deletions
|
|
@ -10,10 +10,10 @@ import { NoResultsIcon } from './icons';
|
||||||
|
|
||||||
interface NoResultsScreenProps
|
interface NoResultsScreenProps
|
||||||
extends AutocompleteApi<
|
extends AutocompleteApi<
|
||||||
InternalDocSearchHit,
|
InternalDocSearchHit,
|
||||||
React.FormEvent,
|
React.FormEvent,
|
||||||
React.MouseEvent,
|
React.MouseEvent,
|
||||||
React.KeyboardEvent
|
React.KeyboardEvent
|
||||||
> {
|
> {
|
||||||
state: AutocompleteState<InternalDocSearchHit>;
|
state: AutocompleteState<InternalDocSearchHit>;
|
||||||
inputRef: React.MutableRefObject<null | HTMLInputElement>;
|
inputRef: React.MutableRefObject<null | HTMLInputElement>;
|
||||||
|
|
@ -26,43 +26,45 @@ export function NoResultsScreen(props: NoResultsScreenProps) {
|
||||||
return (
|
return (
|
||||||
<div className="DocSearch-NoResults">
|
<div className="DocSearch-NoResults">
|
||||||
<div className="DocSearch-Screen-Icon">
|
<div className="DocSearch-Screen-Icon">
|
||||||
<NoResultsIcon/>
|
<NoResultsIcon />
|
||||||
</div>
|
</div>
|
||||||
<p className="DocSearch-Title">
|
<p className="DocSearch-Title">
|
||||||
No results for "<strong>{props.state.query}</strong>".
|
No results for "<strong>{props.state.query}</strong>".
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{searchSuggestions && searchSuggestions.length > 0 && (
|
{searchSuggestions && searchSuggestions.length > 0 && (
|
||||||
<p>
|
<div className="DocSearch-NoResults-Prefill-List">
|
||||||
Try searching for{' '}
|
<p className="DocSearch-Help">Try searching for:</p>
|
||||||
{searchSuggestions.slice(0, 3).reduce<React.ReactNode[]>(
|
<ul>
|
||||||
(acc, search) => [
|
{searchSuggestions.slice(0, 3).reduce<React.ReactNode[]>(
|
||||||
...acc,
|
(acc, search) => [
|
||||||
<button
|
...acc,
|
||||||
className="DocSearch-Prefill"
|
<li><button
|
||||||
key={search}
|
className="DocSearch-Prefill"
|
||||||
onClick={() => {
|
key={search}
|
||||||
props.setQuery(search.toLowerCase() + ' ');
|
onClick={() => {
|
||||||
props.refresh();
|
props.setQuery(search.toLowerCase() + ' ');
|
||||||
props.inputRef.current!.focus();
|
props.refresh();
|
||||||
}}
|
props.inputRef.current!.focus();
|
||||||
>
|
}}
|
||||||
{search}
|
>
|
||||||
</button>,
|
{search}
|
||||||
],
|
</button></li>,
|
||||||
[]
|
],
|
||||||
)}
|
[]
|
||||||
</p>
|
)}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<p className="DocSearch-Help">
|
<p className="DocSearch-Help">
|
||||||
If you believe this query should return results, please{' '}
|
You believe this query should return results?{' '}
|
||||||
<a
|
<a
|
||||||
href="https://github.com/algolia/docsearch-configs/issues/new?template=Missing_results.md"
|
href="https://github.com/algolia/docsearch-configs/issues/new?template=Missing_results.md"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
let us know on GitHub
|
Let us know
|
||||||
</a>
|
</a>
|
||||||
.
|
.
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export function StartScreen(props: StartScreenProps) {
|
||||||
if (props.state.status === 'idle' && props.hasSuggestions === false) {
|
if (props.state.status === 'idle' && props.hasSuggestions === false) {
|
||||||
return (
|
return (
|
||||||
<div className="DocSearch-StartScreen">
|
<div className="DocSearch-StartScreen">
|
||||||
<p className="DocSearch-Help">Your search history will appear here.</p>
|
<p className="DocSearch-Help">No recent searches</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||||
|
|
||||||
export function SelectIcon() {
|
export function SelectIcon() {
|
||||||
return (
|
return (
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20">
|
<svg className="DocSearch-Hit-Select-Icon" width="20" height="20" viewBox="0 0 20 20">
|
||||||
<g
|
<g
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
fill="none"
|
fill="none"
|
||||||
|
|
|
||||||
|
|
@ -538,15 +538,19 @@ html[data-theme='dark'] {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svg.DocSearch-Hit-Select-Icon {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.DocSearch-Hit[aria-selected='true'] svg.DocSearch-Hit-Select-Icon {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.DocSearch-Hit-action-button:hover {
|
.DocSearch-Hit-action-button:hover {
|
||||||
transition: background-color .1s ease-in;
|
transition: background-color .1s ease-in;
|
||||||
background: rgba(0,0,0,0.2);
|
background: rgba(0,0,0,0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.DocSearch-Hit-action-button:active {
|
|
||||||
transform: scale(1.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.DocSearch-Hit-action-button:hover path{
|
.DocSearch-Hit-action-button:hover path{
|
||||||
fill: white;
|
fill: white;
|
||||||
}
|
}
|
||||||
|
|
@ -557,7 +561,7 @@ html[data-theme='dark'] {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
margin: 0 8px;
|
margin: 0 8px;
|
||||||
line-height: 1.1em;
|
line-height: 1.1em;
|
||||||
flex: 2 1 auto;
|
flex: 1 1 auto;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
@ -592,21 +596,47 @@ html[data-theme='dark'] {
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.DocSearch-NoResults-Prefill-List {
|
||||||
|
text-align: left;
|
||||||
|
display: flex;
|
||||||
|
padding-bottom: 24px;
|
||||||
|
align-items: flex-start;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.DocSearch-NoResults-Prefill-List p{
|
||||||
|
width: 50%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.DocSearch-NoResults-Prefill-List ul{
|
||||||
|
padding: 0 12px;
|
||||||
|
flex-grow: 1;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.DocSearch-NoResults-Prefill-List li{
|
||||||
|
list-style-type: '- ';
|
||||||
|
list-style-position: inside;
|
||||||
|
padding: 0;
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
|
||||||
.DocSearch-Prefill {
|
.DocSearch-Prefill {
|
||||||
appearance: none;
|
appearance: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: none;
|
border: none;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
border-radius: 1em;
|
border-radius: 1em;
|
||||||
font-size: 0.8em;
|
font-size: 1em;
|
||||||
background-color: var(--docsearch-muted-color);
|
background: none;
|
||||||
margin: 0 4px;
|
/* background-color: var(--docsearch-muted-color); */
|
||||||
padding: 4px 12px;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.DocSearch-Prefill:hover {
|
.DocSearch-Prefill:hover {
|
||||||
outline: none;
|
outline: none;
|
||||||
background-color: var(--docsearch-primary-color);
|
color: var(--docsearch-primary-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Responsive */
|
/* Responsive */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue