Skip to content

Commit f7930a9

Browse files
authored
Merge pull request #20444 from cgranleese-r7/adds-survey-banner-docs-site
Adds survey banner to the docs site
2 parents 5dd2fef + 5fe57c6 commit f7930a9

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

docs/_includes/header_custom.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
<link rel="stylesheet" href="{% link assets/css/main.css %}">
22

3+
<!-- User Engagement Survey Banner -->
4+
<div id="survey-banner">
5+
<p>📣 We value your feedback — <a href="https://docs.google.com/forms/d/e/1FAIpQLSd9fgpXmyHOYViSaS6jK_6f1Y1nVSU_eA4UH-fWKYeO5HLvww/viewform" target="_blank" rel="noopener">take our 5-minute survey</a></p>
6+
<button id="close-banner" aria-label="Close banner">&times;</button>
7+
</div>

docs/_includes/js/custom.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,44 @@ jtd.onReady(function(ready) {
5858
}
5959
}
6060
});
61+
/*
62+
* Survey Banner Close Functionality
63+
*
64+
* This section handles the interactive behavior for the user engagement survey banner.
65+
*/
66+
(function() {
67+
function initSurveyBanner() {
68+
const banner = document.getElementById('survey-banner');
69+
const closeButton = document.getElementById('close-banner');
70+
const body = document.body;
71+
72+
if (!banner || !closeButton) {
73+
return;
74+
}
75+
76+
if (localStorage.getItem('surveyBannerClosed') === 'true') {
77+
banner.style.display = 'none';
78+
body.classList.add('banner-closed');
79+
} else {
80+
if (banner.offsetParent === null) {
81+
body.appendChild(banner);
82+
}
83+
banner.style.display = 'flex';
84+
banner.style.visibility = 'visible';
85+
banner.style.opacity = '1';
86+
body.classList.remove('banner-closed');
87+
}
88+
89+
closeButton.addEventListener('click', function() {
90+
banner.style.display = 'none';
91+
body.classList.add('banner-closed');
92+
localStorage.setItem('surveyBannerClosed', 'true');
93+
});
94+
}
95+
96+
if (document.readyState === 'loading') {
97+
document.addEventListener('DOMContentLoaded', initSurveyBanner);
98+
} else {
99+
initSurveyBanner();
100+
}
101+
})();

docs/assets/css/main.css

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,80 @@
11
---
22
---
33

4+
/*
5+
* Survey Banner Styles
6+
*
7+
* This stylesheet contains all styling for the user engagement survey banner
8+
* that appears at the top of all pages.
9+
*/
10+
body {
11+
padding-top: 50px !important;
12+
}
13+
14+
body.banner-closed {
15+
padding-top: 0 !important;
16+
}
17+
18+
#survey-banner {
19+
background-color: #2c3e50;
20+
color: white;
21+
padding: 12px 20px;
22+
text-align: center;
23+
font-size: 13px;
24+
position: fixed;
25+
top: 0;
26+
left: 0;
27+
width: 100%;
28+
z-index: 1000;
29+
box-sizing: border-box;
30+
border-bottom: 2px solid #34495e;
31+
display: flex;
32+
align-items: center;
33+
justify-content: center;
34+
gap: 20px;
35+
}
36+
37+
#survey-banner p {
38+
margin: 0;
39+
line-height: 1.4;
40+
flex: 1;
41+
}
42+
43+
#survey-banner a {
44+
color: #3498db;
45+
text-decoration: underline;
46+
}
47+
48+
#survey-banner a:hover {
49+
color: #5dade2;
50+
}
51+
52+
#close-banner {
53+
background: none;
54+
border: none;
55+
color: white;
56+
font-size: 20px;
57+
cursor: pointer;
58+
padding: 0;
59+
width: 24px;
60+
height: 24px;
61+
display: flex;
62+
align-items: center;
63+
justify-content: center;
64+
border-radius: 50%;
65+
transition: background-color 0.2s ease;
66+
flex-shrink: 0;
67+
}
68+
69+
#close-banner:hover {
70+
background-color: rgba(255, 255, 255, 0.1);
71+
}
72+
73+
#close-banner:focus {
74+
outline: 2px solid #3498db;
75+
outline-offset: 2px;
76+
}
77+
478
#main-content p {
579
text-align: justify;
680
}

0 commit comments

Comments
 (0)