Skip to content

Commit

Permalink
fix(docsearch): group search button elements in containers (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Sep 2, 2020
1 parent a8fb063 commit 8640418
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
10 changes: 10 additions & 0 deletions packages/docsearch-css/src/button.css
Expand Up @@ -8,6 +8,7 @@
display: flex;
font-weight: 500;
height: 36px;
justify-content: space-between;
margin: 0 0 0 16px;
padding: 0 8px;
user-select: none;
Expand All @@ -22,6 +23,11 @@
outline: none;
}

.DocSearch-Button-Container {
align-items: center;
display: flex;
}

.DocSearch-Search-Icon {
stroke-width: 1.6;
}
Expand All @@ -35,6 +41,10 @@
padding: 0 12px 0 6px;
}

.DocSearch-Button-Keys {
display: flex;
}

.DocSearch-Button-Key {
align-items: center;
background: var(--docsearch-key-gradient);
Expand Down
18 changes: 11 additions & 7 deletions packages/docsearch-react/src/DocSearchButton.tsx
Expand Up @@ -41,13 +41,17 @@ export const DocSearchButton = React.forwardRef<
{...props}
ref={ref}
>
<SearchIcon />
<span className="DocSearch-Button-Placeholder">Search</span>

<span className="DocSearch-Button-Key">
{key === ACTION_KEY_DEFAULT ? <ControlKeyIcon /> : key}
</span>
<span className="DocSearch-Button-Key">K</span>
<div className="DocSearch-Button-Container">
<SearchIcon />
<span className="DocSearch-Button-Placeholder">Search</span>
</div>

<div className="DocSearch-Button-Keys">
<span className="DocSearch-Button-Key">
{key === ACTION_KEY_DEFAULT ? <ControlKeyIcon /> : key}
</span>
<span className="DocSearch-Button-Key">K</span>
</div>
</button>
);
});

0 comments on commit 8640418

Please sign in to comment.