Skip to content
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

feat(v2): allow to change location of search bar #4199

Merged
merged 5 commits into from
Feb 9, 2021

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Feb 8, 2021

Motivation

Fixes #4157

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

See docs.

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@lex111 lex111 added the pr: new feature This PR adds a new API or behavior. label Feb 8, 2021
@lex111 lex111 requested a review from slorber as a code owner February 8, 2021 21:39
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 8, 2021
Comment on lines -125 to -126
handleSearchBarToggle={setIsSearchBarExpanded}
isSearchBarExpanded={isSearchBarExpanded}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's dead code, although it may be used by third party plugins implementing local search (not Algolia). It doesn't make sense to support it anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

agree, and it's not documented afaik

@netlify
Copy link

netlify bot commented Feb 8, 2021

Deploy preview for docusaurus-2 ready!

Built with commit 0df3750

https://deploy-preview-4199--docusaurus-2.netlify.app

@netlify
Copy link

netlify bot commented Feb 8, 2021

[V1] Deploy preview success

Built with commit 0df3750

https://deploy-preview-4199--docusaurus-1.netlify.app

@github-actions
Copy link

github-actions bot commented Feb 8, 2021

Size Change: +1 B (0%)

Total Size: 156 kB

ℹ️ View Unchanged
Filename Size Change
website/build/assets/css/styles.********.css 17.6 kB 0 B
website/build/assets/js/main.********.js 109 kB 0 B
website/build/blog/2017/12/14/introducing-docusaurus/index.html 21.7 kB +1 B (0%)
website/build/docs/introduction/index.html 180 B 0 B
website/build/index.html 6.94 kB 0 B

compressed-size-action

@lex111 lex111 force-pushed the lex111/search-navbar-item branch from 9857868 to 57c26b2 Compare February 8, 2021 22:04
@@ -73,6 +70,7 @@ function Navbar(): JSX.Element {
}
}, [windowSize]);

const hasSearchNavbarItem = items.some((item) => item.type === 'search');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need help with proper typing this 🤷‍♂️

Copy link
Collaborator

Choose a reason for hiding this comment

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

just added something to fix it

export type NavbarItem = {
  type?: string | undefined;
  items?: NavbarItem[];
  label?: string;
};

it's not the ideal type but we'll improve that later, as there are many things that are not typed correctly currently

Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

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

thanks, LGTM and good enough to merge

fixed a few things and we'll figure out better TS types later

Comment on lines -125 to -126
handleSearchBarToggle={setIsSearchBarExpanded}
isSearchBarExpanded={isSearchBarExpanded}
Copy link
Collaborator

Choose a reason for hiding this comment

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

agree, and it's not documented afaik

@@ -73,6 +70,7 @@ function Navbar(): JSX.Element {
}
}, [windowSize]);

const hasSearchNavbarItem = items.some((item) => item.type === 'search');
Copy link
Collaborator

Choose a reason for hiding this comment

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

just added something to fix it

export type NavbarItem = {
  type?: string | undefined;
  items?: NavbarItem[];
  label?: string;
};

it's not the ideal type but we'll improve that later, as there are many things that are not typed correctly currently

declare module '@theme/NavbarItem/SearchNavbarItem' {
import type {Props as DefaultNavbarItemProps} from '@theme/NavbarItem/DefaultNavbarItem';

export type Props = DefaultNavbarItemProps;
Copy link
Collaborator

Choose a reason for hiding this comment

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

will fix this because it does not take such additional props

@github-actions
Copy link

github-actions bot commented Feb 9, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 85
🟢 Accessibility 96
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-4199--docusaurus-2.netlify.app/classic/

@slorber slorber merged commit b3b658f into master Feb 9, 2021
@lex111
Copy link
Contributor Author

lex111 commented Feb 9, 2021

@slorber cool, thanks!

This was referenced Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Controlling the Location of the Search Bar in v2
3 participants