Skip to content

Commit 3feaae8

Browse files
authored
Update footer and navbar to match PennyLane website (#40)
* Add and modify theme variables to account for new PennyLane footer * Update footer styling to match new PennyLane footer * Add theme variables for footer icon and social icon colour * Fix silent errors while loading custom reST directives * Update year of copyright * Add new theme variables and update existing descriptions * Rename 'socials' to 'social icons' * Update navbar styling to match new PennyLane navbar * Remove deprecated `toc_hover` theme option * Bump version to `0.4.0` * Update wording in changelog message * Update PR number in changelog * Remove one-second delay before closing navbar dropdown * Restore navbar dropdown delay but prevent multiple expansions * Fix layout discrepencies between PennyLane website * Ensure external links open in a new tab or window * Fix compatibility issues with Firefox * Update hover colour of LHS navbar links * Update hover colour of LHS navbar chevrons * Remove link to Xanadu Cloud in footer * Use object instead of array to store timer pairs * Update hover colour of footer links * Keep underline in footer tagline on hover
1 parent 3edca10 commit 3feaae8

File tree

10 files changed

+1145
-349
lines changed

10 files changed

+1145
-349
lines changed

.github/CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
## Release 0.4.0 (development release)
1+
## Release 0.4.0 (current release)
2+
3+
### Improvements
4+
5+
* Updated the navbar and footer configuration and styles to match the PennyLane website.
6+
[#40](https://github.com/XanaduAI/xanadu-sphinx-theme/pull/40)
27

38
### Contributors
49

510
This release contains contributions from (in alphabetical order):
611

7-
## Release 0.3.7 (current release)
12+
[Mikhail Andrenkov](https://github.com/Mandrenkov).
13+
14+
## Release 0.3.7
815

916
### Improvements
1017

README.rst

Lines changed: 79 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ the ``html_theme_options`` dictionary in your ``conf.py`` file.
120120

121121
``google_analytics_tracking_id``
122122
Google Analytics tracking ID to enable website analytics.
123-
123+
124124
``github_repo``
125125
The GitHub organization and repository associated with the documentation. E.g.,
126126
for a GitHub repository https://github.com/Organization/repo, this should be
@@ -155,21 +155,22 @@ The following options customize the appearance of the navigation bar.
155155

156156
``navbar_left_links``
157157
Links on the LHS of the navigation bar in the form of a list of dictionaries
158-
with the ``"name"``, ``"href"``, and optionally, ``"active"`` keys. In addition,
159-
the ``"img"`` key can be used to specify an image for the navbar link,
160-
alongside ``"img_width"`` to specify the width of the image.
158+
with the ``"name"``, ``"href"``, and optionally, ``"external"`` and
159+
``"dropdown"`` keys.
161160

162-
``navbar_right_links``
163-
Links on the RHS of the navigation bar in the form of a list of dictionaries
164-
with the ``"name"`` and ``"href"`` keys.
161+
The ``"external"`` key only determines if an "external link" icon should be
162+
displayed next to the name of the link in the navbar. Otherwise, the value
163+
of the ``"dropdown"`` key is another list of dictionaries of the same form
164+
(except for the ``"dropdown"`` key) and specifies the links which should be
165+
displayed in a dropdrown from the current link.
165166

166-
Footer
167-
------
168-
169-
The following options customize the appearance of the footer.
167+
In addition, the ``"img"`` key can be used to specify an image to replace
168+
the navbar link, alongside ``"img_width"`` to specify the width of the image.
170169

171-
``extra_copyrights``
172-
List of extra copyright notices to place in the footer.
170+
``navbar_right_links``
171+
Links on the RHS of the navigation bar in the form of a list of dictionaries
172+
with the ``"name"``, ``"href"``, and optionally, ``"icon"`` keys. If a link
173+
does not have an ``"icon"`` key, it will be displayed as a solid button.
173174

174175
Table of contents
175176
-----------------
@@ -184,11 +185,6 @@ The following options customize the table of contents.
184185
Whether to show the global table of contents by default via the left sidebar.
185186
If ``False``, then the left sidebar will be disabled.
186187

187-
``toc_hover``
188-
Whether hovering over the active navbar link (or navbar logo if there is
189-
no active navbar link) will show the global table of contents as a dropdown.
190-
Only applies if ``toc_global=False``.
191-
192188
``toc_subset``
193189
If set to ``True``, and the current page has no local table of contents,
194190
the right-hand table of contents will instead display the current subset
@@ -203,9 +199,25 @@ The following options customize the table of contents.
203199
Footer
204200
------
205201

202+
203+
The following options customize the appearance of the footer.
204+
205+
``extra_copyrights``
206+
List of extra copyright notices to place in the footer.
207+
206208
``footer_about``
207-
A dictionary of the form ``{"title": ..., "description": ...}`` that specifies
208-
the 'About' section of the footer. Set to an empty dictionary to remove.
209+
A dictionary of the form
210+
211+
.. code-block:: python
212+
213+
"footer_about": {
214+
"title": "Title",
215+
"icon": "https://...",
216+
"href": "https://...",
217+
"description": "Description"
218+
}
219+
220+
that specifies the 'About' section of the footer.
209221

210222
``footer_links``
211223
A list of dictionaries of the form
@@ -235,13 +247,12 @@ Footer
235247
that specifies footer links. Each top-level dictionary in the list is a
236248
separate titled column. Set to an empty list to remove.
237249

238-
239-
``footer_socials``
250+
``footer_social_icons``
240251
A list of dictionaries of the form
241252

242253
.. code-block:: python
243254
244-
"footer_socials": [
255+
"footer_social_icons": [
245256
{
246257
"icon": "fab fa-twitter",
247258
"href": "https://twitter.com/xanaduai"
@@ -256,10 +267,45 @@ Footer
256267
specifying social media icons. ``icon`` should correspond to a FontAwesome5 icon.
257268
Set to an empty list to remove.
258269

259-
``footer_tagline``
260-
A dictionary of the form ``{"text": "Some text", "href": "https://..."}`` specifying
261-
a tagline hyperlink that appears underneath the social media icons. Set to an
262-
empty dictionary to remove.
270+
``footer_taglines``
271+
A list of dictionaries of the form
272+
273+
.. code-block:: python
274+
275+
"footer_taglines": [
276+
{
277+
"text": "Some text",
278+
"href": "https://..."
279+
},
280+
{
281+
"icon": "Some more text",
282+
"href": "https://..."
283+
},
284+
...
285+
]
286+
287+
specifying tagline hyperlinks that appear underneath the social media icons.
288+
Set to an empty list to remove.
289+
290+
``footer_policies``
291+
A list of dictionaries of the form
292+
293+
.. code-block:: python
294+
295+
"footer_policies": [
296+
{
297+
"text": "Some text",
298+
"href": "https://..."
299+
},
300+
{
301+
"icon": "Some more text",
302+
"href": "https://..."
303+
},
304+
...
305+
]
306+
307+
specifying policy hyperlinks that appear at the bottom of the footer. Set to
308+
an empty list to remove.
263309

264310
Style Colours
265311
-------------
@@ -278,6 +324,9 @@ These should be fully qualified CSS color specifiers such as ``#004B6B`` or
278324
Colours of the "Next" and "Previous" navigation buttons located at the
279325
bottom of most pages.
280326

327+
``social_icon_colour``
328+
Colour of the social icons.
329+
281330
``table_header_background_colour``
282331
Background colour of table headers.
283332

@@ -287,6 +336,9 @@ These should be fully qualified CSS color specifiers such as ``#004B6B`` or
287336
``toc_marker_colour``
288337
Colour of the marker beside the current ToC entry.
289338

339+
``toc_mobile_heading_colour`` and ``toc_mobile_heading_background_colour``
340+
Text and background colours of the mobile ToC heading.
341+
290342
.. configuration-end-inclusion-marker-do-not-remove
291343
292344
Directives

doc/conf.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# -- Project information -----------------------------------------------------
2020

2121
project = 'Xanadu Sphinx Theme'
22-
copyright = '2022, Xanadu Quantum Technologies'
22+
copyright = '2023 | Xanadu | All rights reserved'
2323
author = 'Xanadu Inc.'
2424

2525
# The version info for the project you're documenting, acts as replacement for
@@ -101,28 +101,38 @@
101101
html_theme_options = {
102102
"navbar_name": "Xanadu Sphinx Theme",
103103
"navbar_logo_colour": "#f48fb1",
104-
# "navbar_home_link": "https://pennylane.ai",
105104
"navbar_left_links": [
106-
{
107-
"name": "Blog",
108-
"href": "javascript:void(0);",
109-
},
110105
{
111106
"name": "Search",
112107
"href": "search.html",
113108
},
114109
{
115110
"name": "Documentation",
116111
"href": "index.html",
117-
"active": True,
118-
}
112+
"dropdown": [
113+
{
114+
"name": "Getting Started",
115+
"href": "started.html",
116+
},
117+
{
118+
"name": "GitHub",
119+
"href": "https://github.com/XanaduAI/xanadu-sphinx-theme",
120+
"external": True,
121+
}
122+
]
123+
},
124+
{
125+
"name": "Support",
126+
"href": "https://discuss.pennylane.ai",
127+
"external": True,
128+
},
119129
],
120130
"navbar_right_links": [
121131
{
122132
"name": "GitHub",
123133
"href": "https://github.com/XanaduAI/xanadu-sphinx-theme",
124-
"icon": "fab fa-github",
125-
},
134+
"icon": "bx bxl-github",
135+
}
126136
],
127137
"extra_copyrights": [
128138
"Any extra copyrights can be added here."
@@ -131,11 +141,13 @@
131141
"prev_next_button_colour": "#f48fb1",
132142
"prev_next_button_hover_colour": "#ec407a",
133143
"table_header_background_colour": "#f8bbd0",
144+
"social_icon_colour": "#ec407a",
134145
"text_accent_colour": "#f48fb1",
135146
"toc_marker_colour": "#f48fb1",
147+
"toc_mobile_heading_colour": "#ec407a",
148+
"toc_mobile_heading_background_colour": "#fcd9e5",
136149
"toc_overview": True,
137150
"toc_global": True,
138-
"toc_hover": False,
139151
"relations": True
140152
}
141153

xanadu_sphinx_theme/__init__.py

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def setup(app):
4040
app.add_html_theme("xanadu", str(cwd))
4141

4242
# set default footer sections
43-
for section in ["about", "links", "socials", "tagline"]:
43+
for section in ["about", "links", "policies", "social_icons", "taglines"]:
4444
if f"footer_{section}" not in app.config["html_theme_options"]:
4545
app.config["html_theme_options"][f"footer_{section}"] = XANADU_FOOTER[
4646
f"footer_{section}"
@@ -63,6 +63,8 @@ def setup(app):
6363
XANADU_FOOTER = {
6464
"footer_about": {
6565
"title": "Xanadu",
66+
"icon": "_static/xanadu_logo.svg",
67+
"href": "https://xanadu.ai",
6668
"description": """\
6769
Located in the heart of downtown Toronto, we've brought together
6870
exceptional minds from around the world to build quantum computers
@@ -135,13 +137,18 @@ def setup(app):
135137
"name": "Home",
136138
"href": "https://xanadu.ai/",
137139
},
138-
{"name": "About", "href": "https://xanadu.ai/about/"},
140+
{
141+
"name": "About",
142+
"href": "https://xanadu.ai/about/",
143+
},
139144
{
140145
"name": "Hardware",
141146
"href": "https://xanadu.ai/photonics",
142147
},
143-
{"name": "Careers", "href": "https://xanadu.ai/careers/"},
144-
{"name": "Cloud", "href": "https://cloud.xanadu.ai"},
148+
{
149+
"name": "Careers",
150+
"href": "https://xanadu.ai/careers/",
151+
},
145152
{
146153
"name": "Forum",
147154
"href": "https://discuss.pennylane.ai/",
@@ -153,19 +160,37 @@ def setup(app):
153160
],
154161
},
155162
],
156-
"footer_socials": [
157-
{"icon": "fab fa-twitter", "href": "https://twitter.com/xanaduai"},
158-
{"icon": "fab fa-github", "href": "https://github.com/XanaduAI"},
159-
{"icon": "fab fa-linkedin-in", "href": "https://linkedin.com/company/xanaduai/"},
160-
{"icon": "fab fa-discourse", "href": "https://discuss.pennylane.ai"},
163+
"footer_social_icons": [
164+
{
165+
"icon": "bx bxl-twitter",
166+
"href": "https://twitter.com/xanaduai",
167+
},
168+
{
169+
"icon": "bx bxl-github",
170+
"href": "https://github.com/XanaduAI",
171+
},
172+
{
173+
"icon": "bx bxl-linkedin",
174+
"href": "https://linkedin.com/company/xanaduai/",
175+
},
176+
{
177+
"icon": "bx bxl-discourse",
178+
"href": "https://discuss.pennylane.ai",
179+
},
161180
{
162-
"icon": "fab fa-slack",
181+
"icon": "bx bxl-slack",
163182
"href": "https://u.strawberryfields.ai/slack",
164183
},
165-
{"icon": "fas fa-rss", "href": "https://xanadu.ai/blog"},
184+
{
185+
"icon": "bx bx-rss",
186+
"href": "https://xanadu.ai/blog",
187+
},
166188
],
167-
"footer_tagline": {
168-
"text": "Stay updated with our newsletter",
169-
"href": "https://xanadu.us17.list-manage.com/subscribe?u=725f07a1d1a4337416c3129fd&id=294b062630",
170-
},
189+
"footer_taglines": [
190+
{
191+
"text": "Stay updated with our newsletter",
192+
"href": "https://xanadu.us17.list-manage.com/subscribe?u=725f07a1d1a4337416c3129fd&id=294b062630",
193+
},
194+
],
195+
"footer_policies": [],
171196
}

xanadu_sphinx_theme/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
using the following format: <major>.<minor>.<patch>[-<pre-release>].
44
"""
55

6-
__version__ = "0.4.0-dev"
6+
__version__ = "0.4.0"

0 commit comments

Comments
 (0)