-
Notifications
You must be signed in to change notification settings - Fork 8
FEAT: Add Meilisearch in theme. #200
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
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
4ffe844
Replace the searchfield
Revathyvenugopal162 189ed28
ADD the env variables
Revathyvenugopal162 c58d9cf
Add the dict
Revathyvenugopal162 9298b85
Try to add the env variable
Revathyvenugopal162 1febdbd
Try to add uids
Revathyvenugopal162 7b1c04c
MAking the search field
Revathyvenugopal162 976e523
Add the styles
Revathyvenugopal162 9a66b06
Deploy changes to dev
Revathyvenugopal162 aeea248
Change the width
Revathyvenugopal162 0ee4dd9
Get the pydata if miliesearch not present
Revathyvenugopal162 71c33c6
Change the theme_options
Revathyvenugopal162 bd9fc4e
Add the search button
Revathyvenugopal162 045f0ac
Add the first value in dict
Revathyvenugopal162 4eaa23f
Update src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/mei…
Revathyvenugopal162 cc91235
Add the styles
Revathyvenugopal162 de58751
Merge branch 'feat/meiliserch' of https://github.com/ansys/ansys-sphi…
Revathyvenugopal162 d96e0f8
Add the dark theme
Revathyvenugopal162 6053b4f
Adjust the searchbar width
Revathyvenugopal162 fd3f306
Add the documenttation
Revathyvenugopal162 955ce3a
Add the docstrings
Revathyvenugopal162 0e6c51e
Update doc/source/user_guide/options.rst
Revathyvenugopal162 030180f
Add the searchbar styling
Revathyvenugopal162 e87f78d
Merge branch 'feat/meiliserch' of https://github.com/ansys/ansys-sphi…
Revathyvenugopal162 a8f8637
Update .github/workflows/ci_cd.yml
akaszynski 66526c8
Fix Zoom problem
Revathyvenugopal162 2be13ba
Merge branch 'feat/meiliserch' of https://github.com/ansys/ansys-sphi…
Revathyvenugopal162 3b550fd
Update src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/mei…
Revathyvenugopal162 0c2d0a0
Merge branch 'main' into feat/meiliserch
Revathyvenugopal162 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
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
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 |
|---|---|---|
|
|
@@ -3,4 +3,5 @@ Ansys | |
| ansys | ||
| Ansys Sphinx Theme | ||
| boolean | ||
| datatable | ||
| datatable | ||
| MeiliSearch | ||
45 changes: 45 additions & 0 deletions
45
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html
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,45 @@ | ||
| <!-- Debugging: html_theme_options = {{ html_theme_options }} --> | ||
| {% if theme_use_meilisearch %} | ||
| <!-- Include the MeiliSearch CSS stylesheet only if theme present --> | ||
| <link href="{{ pathto('_static/css/meilisearch.css', 1) }}" rel="stylesheet"> | ||
|
|
||
| <!-- Create a search bar form with a text input and a dropdown selector for the search index --> | ||
| <form class="bd-search d-flex align-items-center" action="{{ pathto('search') }}" method="get"> | ||
| <input type="search" placeholder="Search" class="form-control" id="search-bar-input" autofocus /> | ||
|
|
||
| {% if theme_use_meilisearch.index_uids %} | ||
| <select id="indexUidSelector" class="index-select"> | ||
| {% for index_uid, index_name in theme_use_meilisearch.index_uids.items() %} | ||
| <option value="{{ index_uid }}">{{ index_name }}</option> | ||
| {% endfor %} | ||
| </select> | ||
| {% endif %} | ||
| <i class="fa-solid fa-magnifying-glass"></i> | ||
| <!-- Include the MeiliSearch JavaScript library for the search bar --> | ||
| <script src="https://cdn.jsdelivr.net/npm/docs-searchbar.js@latest/dist/cdn/docs-searchbar.min.js"></script> | ||
| <script> | ||
| // Initialize the MeiliSearch bar with the given API key and host | ||
| // inspect the first value of index UID as default | ||
| let theSearchBar = docsSearchBar({ | ||
| hostUrl: "{{ theme_use_meilisearch.host }}" , | ||
| apiKey: "{{ theme_use_meilisearch.api_key }}" , | ||
| indexUid: "{{ theme_use_meilisearch.index_uids.items()|first|first }}", | ||
| inputSelector: '#search-bar-input, #indexUidSelector', | ||
| enableDarkMode: 'auto', | ||
| debug: true // Set debug to true if you want to inspect the dropdown | ||
| }); | ||
|
|
||
| document.getElementById('indexUidSelector').addEventListener('change', function() { | ||
| theSearchBar.indexUid = this.value; | ||
| theSearchBar.inputSelector = '#docs-searchbar-suggestion'; | ||
| }); | ||
|
|
||
| // Set the focus on the search bar input | ||
| document.getElementById('docs-searchbar-suggestion').focus(); | ||
| </script> | ||
| </form> | ||
| {% else %} | ||
| <!-- If there is no MiliSearch enabled, use the PyData search --> | ||
| {%- extends "pydata_sphinx_theme/components/search-field.html" -%} | ||
| {% endif %} | ||
|
|
125 changes: 125 additions & 0 deletions
125
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/meilisearch.css
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,125 @@ | ||
| @import "https://cdn.jsdelivr.net/npm/docs-searchbar.js@latest/dist/cdn/docs-searchbar.min.css"; | ||
| @import "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"; | ||
|
|
||
| div [data-ds-theme] .searchbox { | ||
| margin: auto; | ||
| display: block; | ||
| width: 600px; | ||
| } | ||
|
|
||
| .dsb-suggestions { | ||
| width: 580px; | ||
| } | ||
|
|
||
| .docs-searchbar-suggestion--category-header { | ||
| background-color: var(--pst-color-border); | ||
| border-radius: 7px; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .docs-searchbar-suggestion--subcategory-column-text { | ||
| color: (var(--pst-color-text-base)); | ||
| } | ||
|
|
||
| div [data-ds-theme] .searchbox input { | ||
| height: 32px; | ||
| border-radius: 8px; | ||
| font-size: 18px; | ||
| font-family: "Open Sans", sans-serif; | ||
| box-shadow: 0px 0px 8px darkgrey; | ||
| } | ||
|
|
||
| .docs-searchbar-footer { | ||
| display: none; | ||
| } | ||
|
|
||
| [class*="docs-searchbar-suggestion"] { | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .docs-searchbar-suggestion--highlight { | ||
| box-shadow: none !important; | ||
| } | ||
|
|
||
| .container { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .meilisearch-autocomplete { | ||
| text-align: center; | ||
| color: var(--pst-color-text-base); | ||
| } | ||
|
|
||
| #search-bar-input{ | ||
| width: 182%; | ||
| background-color: var(--pst-color-background); | ||
| border: 1px solid var(--pst-color-border); | ||
| border-radius: .25rem; | ||
| color: var(--pst-color-text-base); | ||
| font-size: var(--pst-font-size-icon); | ||
| position: relative; | ||
| padding-left: 3rem; | ||
| } | ||
|
|
||
| .meilisearch-autocomplete::before { | ||
| content: "\f002"; | ||
| font-family: "Font Awesome 6 Free"; /* The Font Awesome font family */ | ||
| position: absolute; | ||
| left: 8px; | ||
| top: 50%; | ||
| transform: translateY(-50%); | ||
| font-size: 1rem; | ||
| color: var(--pst-color-border); | ||
| } | ||
|
|
||
| .index-select { | ||
| color: var(--pst-color-text-base); | ||
| background: var(--pst-color-background); | ||
| height: 3rem; | ||
| border: 1px solid var(--pst-color-border); | ||
| border-radius: .25rem; | ||
| font-size: 20px; | ||
| font-family: "Open Sans", sans-serif; | ||
| box-shadow: 0px 0px 20px var(--pst-color-border); | ||
| padding: 0 10px 0px 10px; | ||
| width: 25%; | ||
| position: absolute; | ||
| margin-left: 41em; | ||
| } | ||
|
|
||
| .meilisearch-autocomplete .dsb-dropdown-menu [class^=dsb-dataset-] { | ||
| position: relative; | ||
| border: 1px solid #d9d9d9; | ||
| background: #fff; | ||
| border-radius: 4px; | ||
| overflow: auto; | ||
| padding: 0 8px 8px; | ||
| width: 99%; | ||
| } | ||
|
|
||
| .meilisearch-autocomplete .docs-searchbar-suggestion { | ||
| width: 99%; | ||
| } | ||
|
|
||
| .meilisearch-autocomplete .docs-searchbar-suggestion--highlight { | ||
| color: var(--pst-color-info); | ||
| background: rgb(255 255 255 / 49%); | ||
| padding: 0 .05em; | ||
| } | ||
|
|
||
| .meilisearch-autocomplete .docs-searchbar-suggestion--subcategory-column { | ||
| width: 30%; | ||
| } | ||
|
|
||
| .search-button__wrapper.show form.bd-search { | ||
| flex-grow: 2; | ||
| } | ||
|
|
||
| .d-flex { | ||
| display: flex!important; | ||
| flex-direction: row; | ||
| justify-content: space-between; | ||
| flex-wrap: nowrap; | ||
| } | ||
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
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.