Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

feat(search): introduced search bar functionality #2502

Merged
merged 18 commits into from
Jun 28, 2022

Conversation

ovflowd
Copy link
Member

@ovflowd ovflowd commented Jun 22, 2022

Description

This PR introduces (again) a search box for searching content from the Learn Tab. It indexes in the same way and it uses Elastic Lunr.

The original SearchBox component was copied from #1677 and modified both in functionality to work with the plugin and design to be more responsive.

Screenshots

image

image

image

image

Related Issues

Fixes #413

@ovflowd
Copy link
Member Author

ovflowd commented Jun 22, 2022

Note.: This search box is rendered on all pages. If you folks prefer it to only show on Learn, maybe UX-wise it would fit somewhere else?

@codecov-commenter
Copy link

codecov-commenter commented Jun 22, 2022

Codecov Report

Merging #2502 (9853cdb) into main (c2d400b) will decrease coverage by 1.36%.
The diff coverage is 63.04%.

@@            Coverage Diff             @@
##             main    #2502      +/-   ##
==========================================
- Coverage   91.54%   90.18%   -1.37%     
==========================================
  Files          85       87       +2     
  Lines         923      968      +45     
  Branches      249      261      +12     
==========================================
+ Hits          845      873      +28     
- Misses         78       95      +17     
Impacted Files Coverage Δ
src/components/Header/index.tsx 100.00% <ø> (ø)
src/components/SearchBar/SearchInput.tsx 59.52% <59.52%> (ø)
src/components/Layout/index.tsx 100.00% <100.00%> (ø)
src/components/SearchBar/index.tsx 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2d400b...9853cdb. Read the comment docs.

@benhalverson benhalverson added the create-preview Generate preview on staging.nodejs.dev label Jun 23, 2022
@github-actions github-actions bot removed the create-preview Generate preview on staging.nodejs.dev label Jun 23, 2022
@github-actions
Copy link

Please find a preview at: https://staging.nodejs.dev/2502/

@benhalverson
Copy link
Member

Hi @ovflowd Thanks for working on this. I like the global search over the /learn specific one.

I noticed there are horziontal and vertical scrollbars for the search bar divs.
searchDefault
expandedSearch

@ovflowd
Copy link
Member Author

ovflowd commented Jun 23, 2022

Hey @benhalverson quite interesting, let me see if removing the overflow styles could work.

Would you mind telling me if you're using Linux/Windows? Cause on macOS I'm not able to reproduce this, nor on Fedora.

@ovflowd
Copy link
Member Author

ovflowd commented Jun 23, 2022

Also, thanks for enjoying this approach! I thought that a global approach would be easier for people to notice, and also a version that auto-expands doesn't consume that much real-estate 👀

@ovflowd
Copy link
Member Author

ovflowd commented Jun 23, 2022

I introduced some style fixes and improved how the search container resizes dynamically based on your screen size 😄

@benhalverson
Copy link
Member

benhalverson commented Jun 23, 2022

Would you mind telling me if you're using Linux/Windows? Cause on macOS I'm not able to reproduce this, nor on Fedora.

I was testing on Windows 10 with Chrome

@benhalverson benhalverson added the create-preview Generate preview on staging.nodejs.dev label Jun 23, 2022
@github-actions github-actions bot removed the create-preview Generate preview on staging.nodejs.dev label Jun 23, 2022
@github-actions
Copy link

Please find a preview at: https://staging.nodejs.dev/2502/

@ovflowd
Copy link
Member Author

ovflowd commented Jun 23, 2022

I was testing on Windows 10 with Chrome

Gotcha! Hopefully latest changes fix your issue 🙇

@benhalverson benhalverson added the create-preview Generate preview on staging.nodejs.dev label Jun 24, 2022
@github-actions github-actions bot removed the create-preview Generate preview on staging.nodejs.dev label Jun 24, 2022
@github-actions
Copy link

Please find a preview at: https://staging.nodejs.dev/2502/

@benhalverson benhalverson added the create-preview Generate preview on staging.nodejs.dev label Jun 26, 2022
@github-actions github-actions bot removed the create-preview Generate preview on staging.nodejs.dev label Jun 26, 2022
@github-actions
Copy link

Please find a preview at: https://staging.nodejs.dev/2502/

Copy link
Member

@benhalverson benhalverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@ovflowd
Copy link
Member Author

ovflowd commented Jun 27, 2022

@benhalverson I updated the SearchInput's CSS to match more the design from the Figma's.

image

I also fixed the results not clearing when collapsing and added a limit of 20 results, so that it doesn't show an infinitude of results.

@benhalverson benhalverson added the create-preview Generate preview on staging.nodejs.dev label Jun 27, 2022
@github-actions github-actions bot removed the create-preview Generate preview on staging.nodejs.dev label Jun 27, 2022
@github-actions
Copy link

Please find a preview at: https://staging.nodejs.dev/2502/

@benhalverson benhalverson merged commit 7db36b7 into nodejs:main Jun 28, 2022
@ovflowd ovflowd deleted the feat/search branch October 12, 2022 08:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Search box
4 participants