File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use client' ;
2+ import { usePlausibleEvent } from 'sentry-docs/hooks/usePlausibleEvent' ;
3+
4+ type Props = {
5+ pathname : string ;
6+ } ;
7+
8+ export function DocFeedback ( { pathname} : Props ) {
9+ const { emit} = usePlausibleEvent ( ) ;
10+
11+ const handleFeedback = ( helpful : boolean ) => {
12+ emit ( 'Doc Feedback' , { props : { page : pathname , helpful} } ) ;
13+ } ;
14+
15+ return (
16+ < div className = "flex items-center gap-2 py-4 border-t border-[var(--gray-6)]" >
17+ < span className = "text-sm" > Was this helpful?</ span >
18+ < button
19+ onClick = { ( ) => handleFeedback ( true ) }
20+ className = "w-10 h-10 py-2 px-2 hover:bg-[var(--gray-3)] rounded-full flex items-center justify-center"
21+ aria-label = "Yes, this was helpful"
22+ >
23+ 👍
24+ </ button >
25+ < button
26+ onClick = { ( ) => handleFeedback ( false ) }
27+ className = "w-10 h-10 py-2 px-2 hover:bg-[var(--gray-3)] rounded-full flex items-center justify-center"
28+ aria-label = "No, this wasn't helpful"
29+ >
30+ 👎
31+ </ button >
32+ </ div >
33+ ) ;
34+ }
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import './type.scss';
1212import { Banner } from '../banner' ;
1313import { Breadcrumbs } from '../breadcrumbs' ;
1414import { CodeContextProvider } from '../codeContext' ;
15+ import { DocFeedback } from '../docFeedback' ;
1516import { GitHubCTA } from '../githubCTA' ;
1617import { Header } from '../header' ;
1718import Mermaid from '../mermaid' ;
@@ -91,6 +92,8 @@ export function DocPage({
9192 < CodeContextProvider > { children } </ CodeContextProvider >
9293 </ div >
9394
95+ < DocFeedback pathname = { pathname } />
96+
9497 < div className = "grid grid-cols-2 gap-4 not-prose mt-16" >
9598 < div className = "col-span-1" >
9699 { previousPage && < PaginationNav node = { previousPage } title = "Previous" /> }
Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ import {ReadProgressMilestone} from 'sentry-docs/types/plausible';
44
55// Adding custom events here will make them available via the hook
66type PlausibleEventProps = {
7+ [ 'Doc Feedback' ] : {
8+ helpful : boolean ;
9+ page : string ;
10+ } ;
711 [ 'Read Progress' ] : {
812 page : string ;
913 readProgress : ReadProgressMilestone ;
You can’t perform that action at this time.
0 commit comments