refactor(v2): introduce Logo component, remove useLogo hook#3745
Merged
slorber merged 3 commits intofacebook:masterfrom Nov 16, 2020
Merged
refactor(v2): introduce Logo component, remove useLogo hook#3745slorber merged 3 commits intofacebook:masterfrom
slorber merged 3 commits intofacebook:masterfrom
Conversation
|
Deploy preview for docusaurus-2 ready! Built without sensitive environment variables with commit f49c56c |
|
Deploy preview for docusaurus-2 ready! Built without sensitive environment variables with commit 41afde2 |
Collaborator
|
LGTM thanks, happy to remove that useLogo hook |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
Since the
ThemedImagecomponent has been added, it would be nice to utilize it in the theme files. First thing that came to my mind was the site logo component. After studying a code for a bit, it came apparent that very similar code is used in the all places, so it can be quite easily extracted to the separate file.When I have finished the extraction, the next thing that picked up my attention was
useLogohook, which after the refactor seems redundant too (code can be moved to the newly createdLogocomponent).This hook has not been documented yet on the website - https://v2.docusaurus.io/docs/theme-classic#hooks - (in opposition to the
theme-bootstraphook - https://v2.docusaurus.io/docs/theme-bootstrap/#uselogo), so I think that the removal shouldn't hurt any users. This change also makes code structure a bit simpler.In addition to the changes described above this refactor fixes a HTML check warning when user do not specified the
logo.altfield in the navbar config (fallback totitle, then just to"Logo"string).Unfortunately the
sourceshad to be extracted to the variable due to Rule of Hooks conditional call warnings.Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
Refactor has been tested on the Docusuaurs V2 website locally.
Related PRs