Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ignore the docs build directory
docs/build
docs/build/*
docs/build/html/*
docs/build/html/*
.devcontainer/
53 changes: 53 additions & 0 deletions docs/source/_static/page_feedback.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.page-feedback {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem;
margin-top: 3rem;
padding-top: 1.25rem;
border-top: 1px solid var(--color-background-border);
}

.page-feedback p {
margin: 0;
color: var(--color-foreground-secondary);
}

.page-feedback-buttons {
display: flex;
gap: 0.5rem;
}

.page-feedback-button {
display: inline-flex;
align-items: center;
justify-content: center;
width: 2.25rem;
height: 2.25rem;
padding: 0;
border: 1px solid var(--color-background-border);
border-radius: 50%;
background: transparent;
color: var(--color-foreground-secondary);
cursor: pointer;
}

.page-feedback-button:hover,
.page-feedback-button:focus-visible {
border-color: var(--color-brand-primary);
color: var(--color-brand-primary);
}

.page-feedback-button svg {
width: 1.1rem;
height: 1.1rem;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}

.page-feedback [hidden] {
display: none;
}
19 changes: 19 additions & 0 deletions docs/source/_static/page_feedback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// "Did you find what you were looking for?" widget at the bottom of each page.
// Clicks are logged to Simple Analytics as the "rfdpoly_page_feedback" event.
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll(".page-feedback").forEach(function (widget) {
widget.querySelectorAll(".page-feedback-button").forEach(function (button) {
button.addEventListener("click", function () {
if (typeof window.sa_event === "function") {
window.sa_event("rfdpoly_page_feedback", {
helpful: button.dataset.helpful,
page: widget.dataset.page,
});
}
widget.querySelector(".page-feedback-question").hidden = true;
widget.querySelector(".page-feedback-buttons").hidden = true;
widget.querySelector(".page-feedback-thanks").hidden = false;
});
});
});
});
17 changes: 17 additions & 0 deletions docs/source/_templates/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "!page.html" %}

{% block content %}
{{ super() }}
<div class="page-feedback" data-page="{{ pagename }}">
<p class="page-feedback-question">Did you find what you were looking for?</p>
<div class="page-feedback-buttons">
<button type="button" class="page-feedback-button" data-helpful="yes" aria-label="Yes" title="Yes">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 10v12"/><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/></svg>
</button>
<button type="button" class="page-feedback-button" data-helpful="no" aria-label="No" title="No">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M17 14V2"/><path d="M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"/></svg>
</button>
</div>
<p class="page-feedback-thanks" role="status" hidden>Thanks for your feedback!</p>
</div>
{% endblock %}
5 changes: 5 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,9 @@
# Add external JS files
html_js_files = [
"https://scripts.simpleanalyticscdn.com/latest.js",
"page_feedback.js",
]

html_css_files = [
"page_feedback.css",
]
Loading