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

docs(search): searching with keyboard shortcut #1770

Merged
merged 10 commits into from
Mar 12, 2021

Conversation

ydcjeff
Copy link
Contributor

@ydcjeff ydcjeff commented Mar 11, 2021

Description: searching within the docs is faster now, we can now search with command + K on mac and ctrl + K on windows/linux. And, it still searches correct version docs on each version docs.

https://deploy-preview-1770--pytorch-ignite-preview.netlify.app

Check list:

  • New tests are added (if a new feature is added)
  • New doc strings: description and/or example code are in RST format
  • Documentation is updated (if required)

@github-actions github-actions bot added the docs label Mar 11, 2021
@vfdev-5
Copy link
Collaborator

vfdev-5 commented Mar 11, 2021

Thanks for the PR @ydcjeff ! I disabled for a moment netlify as we can run out in the number of builds per month. Let me activate it for this PR.

@ydcjeff
Copy link
Contributor Author

ydcjeff commented Mar 12, 2021

I disabled for a moment netlify as we can run out in the number of builds per month. Let me activate it for this PR.

For this, I think we can build the docs in github actions and upload the build/html to netlify to lower the build minutes. I haven't tried before tho.

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Mar 12, 2021

Nice addition @ydcjeff ! I was just wondering if we can change this searchbar button to something more subtle
image

I'm a bit bothered by large [Cmd][K] button images and small length of the button vs previous version...

@ydcjeff
Copy link
Contributor Author

ydcjeff commented Mar 12, 2021

@vfdev-5 it is now almost same like previous one, it looks good now

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Mar 12, 2021

Yeah, looks much better now. Do you think we could remove drawn [Apple][K] buttons and just put that into the text "Search", like "Search Docs (Cmd/Ctrl + K)"?

@ydcjeff
Copy link
Contributor Author

ydcjeff commented Mar 12, 2021

Yeah, looks much better now. Do you think we could remove drawn [Apple][K] buttons and just put that into the text "Search" ?

It tells keyboard shortcut for searching, so removing isn't good IMO.

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Mar 12, 2021

Yeah, looks much better now. Do you think we could remove drawn [Apple][K] buttons and just put that into the text "Search" ?

It tells keyboard shortcut for searching, so removing isn't good IMO.

Yeah, I know, I propose to display the shortcut a bit differently. The size of those buttons is a bit too large IMO.

@ydcjeff
Copy link
Contributor Author

ydcjeff commented Mar 12, 2021

OK I see. I inspected that they are directly inside html, I don't know how to edit them.

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Mar 12, 2021

@ydcjeff looks like they are binded to classes that probably could be modified with css ?
Screen Shot 2021-03-12 at 12 43 23

@ydcjeff
Copy link
Contributor Author

ydcjeff commented Mar 12, 2021

Following this answer and adding this to ignite_theme.css

.DocSearch-Button-Placeholder, .DocSearch-Button-Key {
  display: none !important;
}

.DocSearch:after {
  content: "Search Docs (⌘/CTRL + K)";
  padding: 0 12px 0 6px;
}

This works but display failed when launch search modal.

Screen Shot 2021-03-12 at 18 45 19

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Mar 12, 2021

Thanks for digging into it @ydcjeff ! Do you think we could just tweak button's graphical representation, for example, change their size to a smaller one ?

@ydcjeff
Copy link
Contributor Author

ydcjeff commented Mar 12, 2021

I removed box shadow and it shows like

Screen Shot 2021-03-12 at 19 00 10

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Mar 12, 2021

IMO looks better. What do you think, Jeff ?

@ydcjeff
Copy link
Contributor Author

ydcjeff commented Mar 12, 2021

IMO looks better. What do you think, Jeff ?

I am ok with both styles

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Mar 12, 2021

OK, can you update the PR with buttons without shadows to see that integrated

Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

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

Looks great for me now ! Thanks @ydcjeff

@vfdev-5 vfdev-5 merged commit f4569a7 into pytorch:master Mar 12, 2021
@ydcjeff ydcjeff deleted the kbd-docsearch branch March 12, 2021 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants