-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOCS] Was This Helpful section (#9426)
Co-authored-by: Jose Tobar <josectobar@gmail.com>
- Loading branch information
1 parent
85bc9ac
commit 362393d
Showing
63 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
POSTHOG_API_KEY=dummy_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, {useState} from 'react'; | ||
import styles from './styles.module.css'; | ||
import {useLocation} from "@docusaurus/router"; | ||
|
||
export default function WasThisHelpful(){ | ||
|
||
const { pathname } = useLocation(); | ||
const [feedbackSent, setFeedbackSent] = useState(false) | ||
|
||
const handleFeedbackReaction = (eventName) => { | ||
if(!feedbackSent){ | ||
setFeedbackSent(true) | ||
posthog.capture(eventName, { doc_url: pathname }) | ||
} | ||
}; | ||
|
||
return <> | ||
<hr className={styles.feedbackDivider}/> | ||
<section className={styles.feedbackCard}> | ||
<h3 className={styles.feedbackCardTitle}>Was this helpful?</h3> | ||
<div className={styles.feedbackCardActions}> | ||
<button className={feedbackSent ? styles.inactiveFeedbackButton : styles.feedbackButton} onClick={() => handleFeedbackReaction('docs_feedback.yes')}>Yes</button> | ||
<button className={feedbackSent ? styles.inactiveFeedbackButton : styles.feedbackButton} onClick={() => handleFeedbackReaction('docs_feedback.no')}>No</button> | ||
</div> | ||
</section> | ||
</> | ||
} |
64 changes: 64 additions & 0 deletions
64
docs/docusaurus/src/components/WasThisHelpful/styles.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
.feedbackDivider { | ||
border-top: 1px solid var(--gray-400); | ||
margin-top: 3rem; | ||
margin-bottom: 3em; | ||
} | ||
|
||
.feedbackCard { | ||
background-color: var(--gray-100); | ||
border: 1px solid var(--gray-200); | ||
border-radius: 6px; | ||
box-shadow: 0 3px 6px -1px var(--gray-300); | ||
|
||
display: flex; | ||
flex-direction: row; | ||
gap: 1.5rem; | ||
margin: auto; | ||
padding: 0.75rem; | ||
width: 100%; | ||
max-width: 30rem; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.feedbackCardTitle { | ||
font-size: var(--p-font-size); | ||
font-weight: var(--ifm-font-weight-semibold); | ||
margin: 0; | ||
} | ||
|
||
.feedbackCardActions{ | ||
display: flex; | ||
gap: 0.5rem; | ||
} | ||
|
||
.feedbackButton { | ||
border-color: var(--ifm-color-primary); | ||
background: none; | ||
border: 1px solid var(--ifm-color-primary); | ||
border-radius: 50rem; | ||
color: var(--ifm-color-primary); | ||
cursor: pointer; | ||
font-size: var(--p-md-font-size); | ||
font-weight: var(--ifm-font-weight-semibold); | ||
padding: 0.25rem; | ||
text-align: center; | ||
min-width: 4.5rem; | ||
} | ||
|
||
.feedbackButton:hover { | ||
background: var(--orange-100); | ||
color: var(--ifm-color-primary); | ||
} | ||
|
||
.inactiveFeedbackButton { | ||
background: var(--gray-200); | ||
border: 1px solid transparent; | ||
border-radius: 50rem; | ||
color: var(--gray-500); | ||
font-size: var(--p-font-size); | ||
font-weight: var(--ifm-font-weight-semibold); | ||
padding: 0.25rem; | ||
text-align: center; | ||
min-width: 4.5rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import {MDXProvider} from '@mdx-js/react'; | ||
import MDXComponents from '@theme/MDXComponents'; | ||
import WasThisHelpful from "../../components/WasThisHelpful"; | ||
|
||
export default function MDXContent({children}) { | ||
const { | ||
metadata: {frontMatter}, | ||
} = children.type; | ||
return <MDXProvider components={MDXComponents}> | ||
{children} | ||
{ !frontMatter.hide_feedback_survey && <WasThisHelpful/> } | ||
</MDXProvider>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.