Skip to content

Commit

Permalink
docs: changed behavior of feedback component (#2929)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahednasser committed Jan 3, 2023
1 parent cd32795 commit 82d6640
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions www/docs/src/components/Feedback/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,34 @@ export default function Feedback ({
const location = useLocation();

function handleFeedback (e) {
submitFeedback()
setPositiveFeedbac(e.target.classList.contains('positive'));
setShowForm(true);
}

function submitFeedback (e) {
function submitFeedback () {
if (isBrowser) {
if (window.analytics) {
setLoading(true);
if (showForm) {
setLoading(true);
}
window.analytics.track(event, {
url: location.pathname,
label: document.title,
feedback: positiveFeedback ? 'yes' : 'no',
message
}, function () {
setLoading(false);
setShowForm(false);
setSubmittedFeedback(true);
if (showForm) {
setLoading(false);
setShowForm(false);
setSubmittedFeedback(true);
}
})
} else {
setShowForm(false);
setSubmittedFeedback(true);
if (showForm) {
setShowForm(false);
setSubmittedFeedback(true);
}
}
}
}
Expand Down

0 comments on commit 82d6640

Please sign in to comment.