diff --git a/nbsite/_shared_static/hv-sidebar-dropdown.css b/nbsite/_shared_static/hv-sidebar-dropdown.css new file mode 100644 index 0000000..8951972 --- /dev/null +++ b/nbsite/_shared_static/hv-sidebar-dropdown.css @@ -0,0 +1,43 @@ +/* Sidebar styling for the HoloViz dropdown section */ +.hv-sb-dd { + margin-bottom: 0.5em; +} + +.hv-sb-dd .btn-group { + width: 100%; +} + +.hv-sb-dd .hv-sb-dd-value { + text-align: start; + font-size: 0.9rem; +} + +.hv-sb-dd .btn { + background-color: var(--pst-color-surface); + color: var(--pst-color-text-base); +} + +.hv-sb-dd a.btn:hover { + color: var(--pst-color-link-hover); + text-decoration: underline; + text-decoration-thickness: max(3px, 0.1875rem, 0.12em); +} + +.hv-sb-dd .dropdown-toggle-split { + border-left: solid 1px lightgray; +} + +.hv-sb-dd .dropdown-menu { + width: 100%; + background-color: var(--pst-color-surface); + color: var(--pst-color-text-base); +} + +.hv-sb-dd .dropdown-item { + font-size: 0.8rem; +} + +.hv-sb-dd .hv-icon { + font-size: 0.75em; + margin-left: 0.3em; +} diff --git a/nbsite/_shared_templates/hv-sidebar-dropdown.html b/nbsite/_shared_templates/hv-sidebar-dropdown.html new file mode 100644 index 0000000..944c9a9 --- /dev/null +++ b/nbsite/_shared_templates/hv-sidebar-dropdown.html @@ -0,0 +1,29 @@ +{% if hv_sidebar_dropdown %} +
+
+ {% if 'href' in hv_sidebar_dropdown['dropdown_value'] %} + {{ hv_sidebar_dropdown['dropdown_value']['text'] }} + {% else %} + {{ hv_sidebar_dropdown['dropdown_value']['text'] }} + {% endif %} + + +
+
+{% endif %} diff --git a/nbsite/shared_conf.py b/nbsite/shared_conf.py index fd1abaa..cc1adb8 100644 --- a/nbsite/shared_conf.py +++ b/nbsite/shared_conf.py @@ -24,24 +24,6 @@ def holoviz_icon_white(cur_file): return str(icon_path) -def setup(app): - try: - from nbsite.paramdoc import param_formatter, param_skip - app.connect('autodoc-process-docstring', param_formatter) - app.connect('autodoc-skip-member', param_skip) - except ImportError: - print('no param_formatter (no param?)') - - nbbuild.setup(app) - app.connect("builder-inited", remove_mystnb_static) - -def remove_mystnb_static(app): - # Ensure our myst_nb.css is loaded by removing myst_nb static_path - # from config - app.config.html_static_path = [ - p for p in app.config.html_static_path if 'myst_nb' not in p - ] - extensions = [ 'myst_nb', 'sphinx_design', @@ -105,7 +87,8 @@ def remove_mystnb_static(app): 'gallery.css', 'alert.css', 'dataframe.css', - 'scroller.css' + 'scroller.css', + 'hv-sidebar-dropdown.css', ] # A single line footer that includes the copyright and the last updated date. @@ -123,8 +106,8 @@ def remove_mystnb_static(app): # The layout.html template in pydata-sphinx-theme removes the default # sidebar-nav-bs.html template. html_sidebars = { - "index": ["sidebar-nav-bs-alt"], - "**": ["sidebar-nav-bs-alt"], + "index": ["sidebar-nav-bs-alt", "hv-sidebar-dropdown"], + "**": ["sidebar-nav-bs-alt", "hv-sidebar-dropdown"], } # To be reused in a conf.py file to define the `copyright` string reused @@ -207,3 +190,94 @@ def linkcode_resolve(domain, info): return f"{GITHUB_BASE_URL}{package}/blob/main/{package}/{fn}{linespec}" else: return f"{GITHUB_BASE_URL}{package}/blob/v{pver}/{package}/{fn}{linespec}" + + +nbsite_hv_sidebar_dropdown = { + 'dropdown_value': { + 'href': 'https://holoviz.org', + 'text': 'HoloViz.org', + }, + 'libraries': { + 'panel': { + 'text': 'Panel', + 'url': 'https://param.holoviz.org', + 'title': 'Assembling objects from many different libraries into a layout or app, whether in a Jupyter notebook or in a standalone servable dashboard', + }, + 'hvplot': { + 'text': 'hvPlot', + 'url': 'https://hvplot.holoviz.org', + 'title': 'Quickly return interactive HoloViews, GeoViews, or Panel objects from Pandas, Xarray, or other data structures', + }, + 'holoviews': { + 'text': 'HoloViews', + 'url': 'https://holoviews.org', + 'title': 'Declarative objects for instantly visualizable data, building Bokeh plots from convenient high-level specifications', + }, + 'geoviews': { + 'text': 'GeoViews', + 'url': 'https://geoviews.org', + 'title': 'Visualizable geographic data that that can be mixed and matched with HoloViews objects', + }, + 'datashader': { + 'text': 'Datashader', + 'url': 'https://datashader.org', + 'title': 'Rasterizing huge datasets quickly as fixed-size images', + }, + 'param': { + 'text': 'Param', + 'url': 'https://param.holoviz.org', + 'title': 'Make your Python code clearer and more reliable by declaring Parameters', + }, + 'lumen': { + 'text': 'Lumen', + 'url': 'https://lumen.holoviz.org', + 'title': 'Framework for visual analytics that allows users to build data-driven dashboards from a simple YAML specification', + }, + 'colorcet': { + 'text': 'Colorcet', + 'url': 'https://colorcet.holoviz.org', + 'title': 'A wide range of perceptually uniform continuous colormaps and perceptually based categorical color sets for use with the other libraries', + }, + }, + 'others': { + 'examples': { + 'text': 'Examples Gallery', + 'url': 'https://examples.holoviz.org', + 'title': ' Visualization-focused examples using HoloViz for specific topics ', + }, + 'blog': { + 'text': 'Blog', + 'url': 'https://blog.holoviz.org', + 'title': 'HoloViz blog', + }, + }, +} + + +def remove_mystnb_static(app): + # Ensure our myst_nb.css is loaded by removing myst_nb static_path + # from config + app.config.html_static_path = [ + p for p in app.config.html_static_path if 'myst_nb' not in p + ] + + +def add_hv_sidebar_dropdown_context(app, pagename, templatename, context, doctree, *args) -> None: + # Inject it in the context to make it available to the template namespace.s + context['hv_sidebar_dropdown'] = app.config.nbsite_hv_sidebar_dropdown + + +def setup(app): + try: + from nbsite.paramdoc import param_formatter, param_skip + app.connect('autodoc-process-docstring', param_formatter) + app.connect('autodoc-skip-member', param_skip) + except ImportError: + print('no param_formatter (no param?)') + + nbbuild.setup(app) + app.connect("builder-inited", remove_mystnb_static) + + # hv_sidebar_dropdown + app.add_config_value('nbsite_hv_sidebar_dropdown', {}, 'html') + app.connect("html-page-context", add_hv_sidebar_dropdown_context) diff --git a/site/doc/conf.py b/site/doc/conf.py index 8ee84b7..50e15f3 100644 --- a/site/doc/conf.py +++ b/site/doc/conf.py @@ -69,7 +69,6 @@ "icon": "fab fa-discourse", }, ], - "navbar_end": ["navbar-icon-links"], "pygments_light_style": "material", "pygments_dark_style": "material", 'secondary_sidebar_items': [