-
-
Notifications
You must be signed in to change notification settings - Fork 741
Add beeware.org header to Furo Sphinx theme. #3538
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
b354dbc
5274ab1
84710d0
8f4e7eb
8ca6348
cdb33c5
da7e368
aefa04f
cfa670e
b35ab94
860036c
2dbd4fc
69daea1
74bb002
cbb9e7e
7abf512
4f103a9
f5a09af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,155 @@ | ||
/*---------------------------------------------------- | ||
Bootstrap style override | ||
--------------------------------------------------- */ | ||
|
||
/* Fixes issue with background colors being swapped in each mode */ | ||
body[data-theme="dark"] { | ||
background-color: var(--color-background-primary); | ||
} | ||
|
||
body[data-theme="light"] { | ||
background-color: var(--color-background-primary); | ||
} | ||
|
||
/* Fixes issue with background colors on auto color mode */ | ||
@media (prefers-color-scheme: dark) { | ||
body[data-theme=auto] { | ||
background-color: var(--color-background-primary); | ||
} | ||
} | ||
|
||
.navbar { | ||
padding-top: 1em !important; | ||
} | ||
|
||
.fixed-top { | ||
position: relative !important; | ||
} | ||
|
||
.navbar-brand img { | ||
max-width: initial; | ||
} | ||
|
||
.navbar-brand, .navbar-nav { | ||
font-family: 'Cutive', serif; | ||
font-weight: 600; | ||
letter-spacing: -0.6px; | ||
} | ||
|
||
/*---------------------------------------------------- | ||
Furo style override | ||
--------------------------------------------------- */ | ||
|
||
/* This setting in Furo compounds with other font sizes and breaks the layout */ | ||
@media (min-width: 97em) { | ||
html { | ||
font-size: 100%; | ||
} | ||
} | ||
|
||
.main { | ||
margin-top: 1em; | ||
} | ||
|
||
.sidebar-drawer, .toc-drawer { | ||
padding-top: 3em; | ||
freakboy3742 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
.mobile-header { | ||
position: unset; | ||
} | ||
|
||
/* Fixes the "View this page" icon color in dark modes */ | ||
body[data-theme="dark"] { | ||
.view-this-page svg { | ||
color: #cfd0d0; | ||
} | ||
} | ||
|
||
body[data-theme=auto] a.muted-link { | ||
color: #cfd0d0; | ||
} | ||
|
||
.page h1 { | ||
font-family: 'Cutive', serif; | ||
margin-top: 1em; | ||
} | ||
|
||
.page h2 { | ||
font-family: 'Cutive', serif; | ||
font-size: 160%; | ||
margin: 1.8rem 0 0.8rem 0; | ||
line-height: 2rem; | ||
} | ||
|
||
.page h2:first-child { | ||
margin-top: 1.4rem; | ||
} | ||
|
||
.page h3 { | ||
font-family: 'Cutive', serif; | ||
font-size: 135%; | ||
margin: 1.8rem 0 0.8rem 0; | ||
line-height: 1.8rem; | ||
} | ||
|
||
.page h3:first-child { | ||
margin-top: 1.0rem; | ||
} | ||
|
||
.page h4 { | ||
font-family: 'Cutive', serif; | ||
margin: 1.8rem 0 0.8rem 0; | ||
font-size: 120%; | ||
line-height: 1.6rem; | ||
} | ||
|
||
.page h4:first-child { | ||
margin-top: 0.8rem; | ||
} | ||
|
||
|
||
.page h5 { | ||
font-family: 'Cutive', serif; | ||
font-size: 110%; | ||
margin: 1.8rem 0 0.8rem; | ||
line-height: 1.6rem; | ||
} | ||
|
||
.page h6:first-child { | ||
margin-top: 0.8rem; | ||
} | ||
|
||
.page h6 { | ||
font-family: 'Cutive', serif; | ||
margin: 1.8rem 0 0.8rem 0; | ||
font-size: 100%; | ||
line-height: 1.6rem; | ||
} | ||
|
||
.page h6:first-child { | ||
margin-top: 0.8rem; | ||
} | ||
|
||
.sidebar-brand-text { | ||
font-family: 'Cutive', serif; | ||
} | ||
|
||
.github-links { | ||
font-family: 'Cutive', serif; | ||
padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal); | ||
font-size: 1.25em; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure we need this level of size emphasis; the link existing (maybe with a font-awesome Github icon as well?) is probably enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rest of the ToC tree is set to be smaller than the standard unset font size. I realised after the fact, that these two screenshots look really similar. I promise they are different. Do you want it left to its own devices, which is shown in the first screenshot? Or would you prefer I make it the same size as the ToC tree, shown in the second screenshot? It uses a variable to do this, the reuse of which seems to be working successfully. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Further, two questions:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd go with ToC tree sizing, but we might as well use Cutive to make it stand out a bit. As for the font-awesome icon... I've modified the config so that RTD builds and |
||
} | ||
|
||
.github-links a { | ||
color: var(--color-sidebar-link-text--top-level); | ||
} | ||
|
||
.github-link { | ||
padding-top: 0.5em; | ||
} | ||
|
||
|
||
div.table { | ||
clear: both; | ||
display: flex; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<!doctype html> | ||
<html class="no-js"{% if language is not none %} lang="{{ language }}"{% endif %} data-content_root="{{ content_root }}"> | ||
<head> | ||
{%- block site_meta -%} | ||
<meta charset="utf-8"/> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"/> | ||
<meta name="color-scheme" content="light dark"> | ||
|
||
{%- if metatags %}{{ metatags }}{% endif -%} | ||
|
||
{%- block linktags %} | ||
{%- if hasdoc('about') -%} | ||
<link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" /> | ||
{%- endif -%} | ||
{%- if hasdoc('genindex') -%} | ||
<link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" /> | ||
{%- endif -%} | ||
{%- if hasdoc('search') -%} | ||
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" /> | ||
{%- endif -%} | ||
{%- if hasdoc('copyright') -%} | ||
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" /> | ||
{%- endif -%} | ||
{%- if next -%} | ||
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" /> | ||
{%- endif -%} | ||
{%- if prev -%} | ||
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" /> | ||
{%- endif -%} | ||
{#- rel="canonical" (set by html_baseurl) -#} | ||
{%- if pageurl %} | ||
<link rel="canonical" href="{{ pageurl|e }}" /> | ||
{%- endif %} | ||
{%- endblock linktags %} | ||
|
||
{# Favicon #} | ||
{%- if favicon_url -%} | ||
<link rel="shortcut icon" href="{{ favicon_url }}"/> | ||
{%- endif -%} | ||
|
||
<!-- Generated with Sphinx {{ sphinx_version }} and Furo {{ furo_version }} --> | ||
|
||
{%- endblock site_meta -%} | ||
|
||
{#- Site title -#} | ||
{%- block htmltitle -%} | ||
{% if not docstitle %} | ||
<title>{{ title|striptags|e }}</title> | ||
{% elif pagename == master_doc %} | ||
<title>{{ docstitle|striptags|e }}</title> | ||
{% else %} | ||
<title>{{ title|striptags|e }} - {{ docstitle|striptags|e }}</title> | ||
{% endif %} | ||
{%- endblock -%} | ||
|
||
{%- block styles -%} | ||
|
||
|
||
{# Custom stylesheets #} | ||
{%- block regular_styles -%} | ||
{%- for css in css_files -%} | ||
{% if css|attr("filename") -%} | ||
{{ css_tag(css) }} | ||
{%- else -%} | ||
<link rel="stylesheet" href="{{ pathto(css, 1)|e }}" type="text/css" /> | ||
{%- endif %} | ||
{% endfor -%} | ||
{%- endblock regular_styles -%} | ||
|
||
{#- Theme-related stylesheets -#} | ||
{%- block theme_styles %} | ||
{% include "partials/_head_css_variables.html" with context %} | ||
{%- endblock -%} | ||
<!-- Bootstrap CSS --> | ||
<link rel="stylesheet" type="text/css" href="https://beeware.org/static/bootstrap/css/bootstrap.min.css"> | ||
<link rel="stylesheet" type="text/css" href="https://beeware.org/static/bootstrap/css/bootstrap-grid.min.css"> | ||
<!-- BeeWare Font --> | ||
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Cutive"> | ||
{%- block extra_styles %} | ||
{%- endblock -%} | ||
|
||
<!-- Font Awesome --> | ||
<script src="https://kit.fontawesome.com/078c86a30a.js" crossorigin="anonymous"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mental note that I may need to modify my font-awesome domain permission here. |
||
{%- endblock styles -%} | ||
|
||
{#- Custom front matter #} | ||
{%- block extrahead -%}{%- endblock -%} | ||
</head> | ||
<body> | ||
{% block body %} | ||
<script> | ||
document.body.dataset.theme = localStorage.getItem("theme") || "auto"; | ||
</script> | ||
{% include "header.html" %} | ||
{% endblock %} | ||
|
||
{%- block scripts -%} | ||
|
||
{# Custom JS #} | ||
{%- block regular_scripts -%} | ||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> | ||
<script src="https://beeware.org/static/bootstrap/js/bootstrap.min.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the look of the javascript console when running locally,=, there's another JS file needed here (popper.js) |
||
{% for path in script_files -%} | ||
{{ js_tag(path) }} | ||
{% endfor -%} | ||
{%- endblock regular_scripts -%} | ||
|
||
{# Theme-related JavaScript code #} | ||
{%- block theme_scripts -%} | ||
{%- endblock -%} | ||
|
||
{%- endblock scripts -%} | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> | ||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsDefault" aria-controls="navbarsDefault" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="nav-top"> | ||
<div class="navbar-brand-block"> | ||
<a class="navbar-brand" href="https://beeware.org"><img class="mx-2" src="/_static/images/brutus-32.png">BeeWare</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't rendering on the RTD preview... I suspect because the root URL for RTD won't have this. Don't know if there's a better fix for this, and maybe we just have to live with it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other problem with troubleshooting this is that it renders in testing. So I would have to start making changes, pushing them, and seeing whether RtD shapes up. I'm ok with doing this, but not unless you confirm you want me to. Please let me know your thoughts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm OK with this being a "known issue" with testing. We already have analogous issues with font-awesome icons; as long as we know the limitation exists, we can work around it. I was more hoping there might be a "{{ root_url }}" template piece that could be used - but if there isn't, that's fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't know this was a thing. It renders locally with the latest addition. We'll see if it works with RtD. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh - I have no idea if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh fair enough. I'll dig a bit further... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So RtD evidently automatically supplies a |
||
</div> | ||
</div> | ||
<div class="collapse navbar-collapse" id="navbarsDefault"> | ||
<ul class="navbar-nav mr-auto"> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://beeware.org/about">About</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Observation - these render on beeware.org as "unselected" unless it's the current page. I'm pretty sure we can just render |
||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://beeware.org/project">Projects</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://beeware.org/community">Community</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://beeware.org/contributing">Contributing</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://beeware.org/news">News</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://beeware.org/membership">Donate</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</nav> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{#- | ||
|
||
Hi there! | ||
|
||
You might be interested in https://pradyunsg.me/furo/customisation/sidebar/ | ||
|
||
Although if you're reading this, chances are that you're either familiar | ||
enough with Sphinx that you know what you're doing, or landed here from that | ||
documentation page. | ||
|
||
Hope your day's going well. :) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤣 Is this your doing, or Pradyuns? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Entirely Pradyun's. It exists in all the files that you can customise through the Furo config, as an attempt to avoid you unnecessarily doing what we're doing. It is necessary for us, so here we are. Probably not worth removing, as any future diff would include it and show up as a change to be updated. That said, I can obviously remove it if you prefer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh no - keep it in. If someone is elbow deep in this file, they deserve a little pick me up :-) |
||
|
||
-#} | ||
<a class="sidebar-brand{% if logo %} centered{% endif %}" href="{{ pathto(master_doc) }}"> | ||
{% block brand_content %} | ||
{%- if logo_url %} | ||
<div class="sidebar-logo-container"> | ||
<img class="sidebar-logo" src="{{ logo_url }}" alt="Logo"/> | ||
</div> | ||
{%- endif %} | ||
{%- if theme_light_logo and theme_dark_logo %} | ||
<div class="sidebar-logo-container"> | ||
<img class="sidebar-logo only-light" src="{{ pathto('_static/' + theme_light_logo, 1) }}" alt="Light Logo"/> | ||
<img class="sidebar-logo only-dark" src="{{ pathto('_static/' + theme_dark_logo, 1) }}" alt="Dark Logo"/> | ||
</div> | ||
{%- endif %} | ||
{% if not theme_sidebar_hide_name %} | ||
<span class="sidebar-brand-text">{{ docstitle if docstitle else project }}</span> | ||
{%- endif %} | ||
{% endblock brand_content %} | ||
</a> | ||
<div class="github-links"> | ||
<div class="github-link"> | ||
<a href="https://github.com/beeware/toga">Source Code</a> | ||
</div> | ||
<div class="github-link"> | ||
<a href="https://github.com/beeware/toga/issues">Issues</a> | ||
</div> | ||
</div> |
Uh oh!
There was an error while loading. Please reload this page.