Skip to content

Commit e40f827

Browse files
authored
Merge pull request #304 from AR21SM/footer
Footer with Dark/Light Mode | Responsive & Accessible Redesign (#201)
2 parents 4ec1704 + 15d6735 commit e40f827

File tree

10 files changed

+191
-13
lines changed

10 files changed

+191
-13
lines changed

DISCOVER/_config.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
title: DISCOVER
55
author: Community
6-
logo: _static/logo-light.png
6+
logo: _static/images/logo-light.png
77

88
# Force re-execution of notebooks on each build.
99
# See https://jupyterbook.org/content/execute.html
@@ -22,9 +22,12 @@ html:
2222
use_issues_button: true
2323
use_repository_button: true
2424
html_in_header:
25-
- '<script src="_static/logo-switcher.js"></script>'
25+
- '<script src="_static/js/logo-switcher.js"></script>'
26+
- '<script src="_static/js/footer.js"></script>'
27+
28+
2629
extra_css:
27-
- _static/mainLogo.css
30+
- _static/css/mainLogo.css
2831

2932
# config sphinx tags extension
3033
sphinx:

DISCOVER/_static/css/mainLogo.css

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/* Image styling for content area */
2+
html[data-theme=dark] .bd-content img:not(.only-dark,.dark-light) {
3+
background: transparent !important;
4+
border-radius: .25rem;
5+
}
6+
7+
html .bd-content img:not(.only-dark,.dark-light) {
8+
padding: 1rem 0;
9+
}
10+
11+
/* Custom footer styles */
12+
13+
.bd-footer-content_inner {
14+
display: flex;
15+
align-items: center;
16+
justify-content: space-between;
17+
padding: 1.5rem 0;
18+
flex-wrap: wrap;
19+
gap: 1rem;
20+
}
21+
22+
.footer-logo {
23+
flex: 0 0 auto;
24+
margin-left: 1rem;
25+
margin-right: 2rem;
26+
}
27+
28+
.numfocus-logo {
29+
30+
max-width: 120px;
31+
height: auto;
32+
}
33+
34+
.footer-links {
35+
display: flex;
36+
gap: 1.5rem;
37+
flex: 1;
38+
align-items: center;
39+
flex-wrap: wrap;
40+
}
41+
42+
.footer-links a {
43+
color:#48566b;
44+
text-decoration: none;
45+
font-size: 0.9rem;
46+
white-space: nowrap;
47+
transition: color 0.2s ease;
48+
}
49+
50+
.footer-links a:hover {
51+
color:#222832;
52+
text-decoration: underline;
53+
}
54+
55+
.copyright {
56+
color: #777;
57+
font-size: 0.85rem;
58+
margin: 0;
59+
white-space: nowrap;
60+
}
61+
62+
.social-links {
63+
display: flex;
64+
gap: 1rem;
65+
margin-left: auto;
66+
}
67+
68+
.social-links a {
69+
color:#48566b;
70+
transition: color 0.2s ease;
71+
}
72+
73+
.social-links a:hover {
74+
color: #222832;
75+
}
76+
77+
.social-links svg {
78+
width: 20px;
79+
height: 20px;
80+
}
81+
82+
html[data-theme=dark] .footer-links a {
83+
color: #bbb;
84+
}
85+
86+
html[data-theme=dark] .footer-links a:hover {
87+
color: #fff;
88+
}
89+
90+
html[data-theme=dark] .copyright {
91+
color: #999;
92+
}
93+
94+
html[data-theme=dark] .social-links a {
95+
color: #aaa;
96+
}
97+
98+
html[data-theme=dark] .social-links a:hover {
99+
color: #fff;
100+
}
101+
102+
@media (max-width: 768px) {
103+
.bd-footer-content_inner {
104+
flex-direction: column;
105+
align-items: center;
106+
text-align: center;
107+
}
108+
109+
.footer-logo {
110+
margin-right: 0;
111+
}
112+
113+
.footer-links {
114+
justify-content: center;
115+
margin: 0.5rem 0;
116+
}
117+
118+
.social-links {
119+
margin: 1rem 0 0 0;
120+
}
121+
}
73.1 KB
Loading
Loading
File renamed without changes.

DISCOVER/_static/js/footer.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
document.addEventListener('DOMContentLoaded', function() {
2+
const existingFooter = document.querySelector('.bd-footer-content');
3+
4+
if (existingFooter) {
5+
existingFooter.innerHTML = '';
6+
7+
const footerContent = document.createElement('div');
8+
footerContent.className = 'bd-footer-content_inner container';
9+
footerContent.innerHTML = `
10+
<div class="footer-logo">
11+
<a href="https://numfocus.org" target="_blank" rel="noopener">
12+
<img src="_static/images/Numfocus-logo-dark.png" alt="NumFOCUS" class="numfocus-logo light-mode-only">
13+
<img src="_static/images/Numfocus-logo-light.png" alt="NumFOCUS" class="numfocus-logo dark-mode-only">
14+
</a>
15+
</div>
16+
17+
<div class="footer-links">
18+
<a href="https://numfocus.org/privacy-policy" target="_blank" rel="noopener">Privacy Policy</a>
19+
<a href="https://numfocus.org/code-of-conduct" target="_blank" rel="noopener">Code of Conduct</a>
20+
<a href="https://numfocus.org/support" target="_blank" rel="noopener">Support</a>
21+
<a href="https://numfocus.org/donate" target="_blank" rel="noopener">Donate</a>
22+
<span class="copyright">© Copyright 2023</span>
23+
</div>
24+
25+
<div class="social-links">
26+
<a href="https://github.com/numfocus" target="_blank" rel="noopener" aria-label="GitHub">
27+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.6.113.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"/></svg>
28+
</a>
29+
<a href="https://x.com/NumFOCUS" target="_blank" rel="noopener" aria-label="X (Twitter)">
30+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"/></svg>
31+
</a>
32+
<a href="https://www.linkedin.com/company/numfocus/" target="_blank" rel="noopener" aria-label="LinkedIn">
33+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z"/></svg>
34+
</a>
35+
</div>
36+
`;
37+
38+
const styleElement = document.createElement('style');
39+
styleElement.textContent = `
40+
/* Theme-specific logo visibility */
41+
.light-mode-only {
42+
display: block;
43+
}
44+
45+
.dark-mode-only {
46+
display: none;
47+
}
48+
49+
html[data-theme="dark"] .light-mode-only {
50+
display: none;
51+
}
52+
53+
html[data-theme="dark"] .dark-mode-only {
54+
display: block;
55+
}
56+
`;
57+
document.head.appendChild(styleElement);
58+
59+
existingFooter.appendChild(footerContent);
60+
}
61+
});

DISCOVER/_static/logo-switcher.js renamed to DISCOVER/_static/js/logo-switcher.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ document.addEventListener('DOMContentLoaded', () => {
33
const isTagsFolder = window.location.pathname.includes('/_tags/');
44
logos.forEach(logo => {
55
if (logo.classList.contains('only-light')) {
6-
logo.src = isTagsFolder ? '../_static/logo-light.png' : '_static/logo-light.png';// Replacing with the light logo
6+
logo.src = isTagsFolder ? '../_static/images/logo-light.png' : '_static/images/logo-light.png';// Replacing with the light logo
77
} else if (logo.classList.contains('only-dark')) {
8-
logo.src = isTagsFolder ? '../_static/logo-dark.png' : '_static/logo-dark.png';// Replacing with the dark logo
8+
logo.src = isTagsFolder ? '../_static/images/logo-dark.png' : '_static/images/logo-dark.png';// Replacing with the dark logo
99
}
1010
});
1111

@@ -14,7 +14,7 @@ document.addEventListener('DOMContentLoaded', () => {
1414
let isDarkMode = document.documentElement.getAttribute("data-theme") === "dark"; // Check theme
1515

1616
if (mainLogo) {
17-
mainLogo.src = isDarkMode ? "_static/logo-dark.png" : "_static/logo-light.png"; // Change image source
17+
mainLogo.src = isDarkMode ? "_static/images/logo-dark.png" : "_static/images/logo-light.png"; // Change image source
1818
}
1919
}
2020

DISCOVER/_static/mainLogo.css

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)