forked from floating-ui/popper.js.org
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(search): update search to DocSearch v3 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+278
β212
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e3e7614
deps: upgrade to docsearch v3
4e12083
feat: integrate DocSearch v3
1edb1aa
refactor: remove unused import
9b9442d
refactor: remove shadowing component
4337ff6
refactor: removing filtering on version
af4f0b6
Update src/components/Search.js
387157a
style(search): extend search Icon
8da678d
refactor(search): remove duplicate
9e1a9e1
style(search): override default styling on key controls
65f6460
style(search): keep constrast consistent within search button
3d5de3a
feat(search): preload page data when hits are hovered
9242d82
style(search): override default styling on li
4ce39b1
style(search): fix contrast on commands keys
9625f82
style(search): refactor rules
7345e92
style(search): center vertically center commands keys, should be remoβ¦
e57c468
Revert "style(search): keep constrast consistent within search button"
1211cbc
style(search): increase contrast on search button
e7869df
style(search): refine searchbox shadow
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| import('@docsearch/react/style'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| import { Fragment } from 'react'; | ||
| import { Global, css } from '@emotion/core'; | ||
| import { DocSearch } from '@docsearch/react'; | ||
| import { Link, navigate } from 'gatsby'; | ||
|
|
||
| const Hit = ({ hit, children }) => { | ||
| return <Link to={hit.url}>{children}</Link>; | ||
| }; | ||
|
|
||
| const Search = () => ( | ||
| <Fragment> | ||
| <Global | ||
| styles={css` | ||
| :root { | ||
| --docsearch-primary-color: #ff6b81; | ||
| --docsearch-text-color: rgb(245, 246, 247); | ||
| --docsearch-container-background: rgba(9, 10, 17, 0.8); | ||
| --docsearch-modal-background: #281e36; | ||
| --docsearch-modal-shadow: inset 1px 1px 0 0 rgb(44, 46, 64), | ||
| 0 3px 8px 0 rgb(0, 3, 9); | ||
| --docsearch-searchbox-background: rgb(9, 10, 17); | ||
| --docsearch-searchbox-focus-background: #000; | ||
| --docsearch-hit-color: rgb(190, 195, 201); | ||
| --docsearch-hit-shadow: none; | ||
| --docsearch-hit-background: rgb(9, 10, 17); | ||
| --docsearch-key-gradient: linear-gradient( | ||
| -26.5deg, | ||
| var(--docsearch-modal-background) 0%, | ||
| rgb(65 46 80) 100% | ||
| ); | ||
| --docsearch-key-shadow: inset 0 -2px 0 0 rgb(81 31 82), | ||
|
s-pace marked this conversation as resolved.
|
||
| inset 0 0 1px 1px rgb(125 81 111), 0 2px 2px 0 rgba(3, 4, 9, 0.5); | ||
| --docsearch-footer-background: #2f263c; | ||
| --docsearch-footer-shadow: inset 0 1px 0 0 rgba(73, 76, 106, 0.5), | ||
| 0 -4px 8px 0 rgba(0, 0, 0, 0.2); | ||
| --docsearch-logo-color: #fff; | ||
| --docsearch-muted-color: rgb(127, 132, 151); | ||
|
|
||
| .DocSearch-Button { | ||
|
s-pace marked this conversation as resolved.
|
||
| --docsearch-searchbox-background: rgb(235, 237, 240); | ||
| --docsearch-searchbox-focus-background: #fff; | ||
| --docsearch-text-color: rgb(28, 30, 33); | ||
| --docsearch-muted-color: rgb(117 124 138); | ||
| --docsearch-key-gradient: linear-gradient( | ||
| -225deg, | ||
| rgb(213, 219, 228) 0%, | ||
| rgb(248, 248, 248) 100% | ||
| ); | ||
| --docsearch-searchbox-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3); | ||
| --docsearch-key-shadow: inset 0 -2px 0 0 rgb(205, 205, 230), | ||
| inset 0 0 1px 1px #fff, 0 1px 2px 1px rgba(30, 35, 90, 0.4); | ||
| } | ||
| } | ||
|
|
||
| .DocSearch-Button { | ||
| margin: 10px; | ||
| height: 39px; | ||
| } | ||
|
|
||
| .DocSearch-Button-Placeholder { | ||
| width: 100%; | ||
|
s-pace marked this conversation as resolved.
|
||
| text-align: left; | ||
| } | ||
|
|
||
| .DocSearch-Search-Icon { | ||
| width: 28px; | ||
| } | ||
|
|
||
| .DocSearch-Modal { | ||
| a { | ||
| border-bottom-style: none; | ||
| } | ||
| li { | ||
| margin-bottom: 0; | ||
| } | ||
| .DocSearch-Commands-Key { | ||
| padding-bottom: 1px; | ||
| } | ||
| } | ||
|
|
||
| @media (max-width: 750px) { | ||
| .DocSearch-Button-KeySeparator, | ||
| .DocSearch-Button-Key { | ||
| display: flex; | ||
| } | ||
|
|
||
| .DocSearch-Button-Placeholder { | ||
| display: flex; | ||
| } | ||
| } | ||
| `} | ||
| /> | ||
| <DocSearch | ||
| apiKey="d5fa05c4e33e776fbf2b8021cbc15b37" | ||
| indexName="popper" | ||
| navigator={{ | ||
| navigate({ suggestionUrl }) { | ||
| navigate(suggestionUrl); | ||
| }, | ||
| }} | ||
| hitComponent={Hit} | ||
| transformItems={items => { | ||
| return items.map(item => { | ||
| // We transform the absolute URL into a relative URL to | ||
| // leverage Gatsby's preloading. | ||
| const a = document.createElement('a'); | ||
| a.href = item.url; | ||
|
|
||
| return { | ||
| ...item, | ||
| url: `${a.pathname}${a.hash}`, | ||
| }; | ||
| }); | ||
| }} | ||
| /> | ||
| </Fragment> | ||
| ); | ||
|
|
||
| export default Search; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.