diff --git a/src/assets/thumbs-down.svg b/src/assets/thumbs-down.svg index 2ed371e3dfd..3d057ecd484 100644 --- a/src/assets/thumbs-down.svg +++ b/src/assets/thumbs-down.svg @@ -1,5 +1,5 @@ + d="M14.1668 2.31966L14.1668 11.4863M18.3335 9.81966L18.3335 3.98633C18.3335 3.06585 17.5873 2.31966 16.6668 2.31966L5.47829 2.31966C4.24436 2.31966 3.19499 3.21994 3.00736 4.43952L2.10993 10.2729C1.87694 11.7872 3.04864 13.153 4.58086 13.153L7.50016 13.153C7.9604 13.153 8.3335 13.5261 8.3335 13.9863L8.3335 16.9315C8.3335 18.0663 9.25349 18.9863 10.3884 18.9863C10.659 18.9863 10.9043 18.8269 11.0143 18.5796L13.9469 11.9812C14.0806 11.6803 14.3791 11.4863 14.7084 11.4863L16.6668 11.4863C17.5873 11.4863 18.3335 10.7401 18.3335 9.81966Z" + stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round" /> diff --git a/src/components/Button/index.module.scss b/src/components/Button/index.module.scss index 21c093871fe..c74d86b6cbd 100644 --- a/src/components/Button/index.module.scss +++ b/src/components/Button/index.module.scss @@ -115,7 +115,7 @@ &.outline { color: var(--logto-color-text); - border-color: var(--logto-color-text); + border-color: var(--logto-border); } &.plain { diff --git a/src/theme/EditMetaRow/index.tsx b/src/theme/EditMetaRow/index.tsx index 679f295ed30..1f3c3a52af4 100644 --- a/src/theme/EditMetaRow/index.tsx +++ b/src/theme/EditMetaRow/index.tsx @@ -11,6 +11,11 @@ import Textarea from '@site/src/components/Textarea'; import styles from './styles.module.scss'; +const likeWebhookUrl = + 'https://hooks.slack.com/triggers/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'; +const feedbackWebhookUrl = + 'https://hooks.slack.com/triggers/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'; + export default function EditMetaRow({ className, editUrl }: Props): JSX.Element { const [showTextarea, setShowTextarea] = useState(false); const [showSuccessMessage, setShowSuccessMessage] = useState(false); @@ -32,16 +37,15 @@ export default function EditMetaRow({ className, editUrl }: Props): JSX.Element { - window.plausible?.('Docs Helpful'); + void fetch(likeWebhookUrl, { + method: 'POST', + body: JSON.stringify({ url: window.location.href }), + }); setShowSuccessMessage(true); }} > - {translate({ - id: 'theme.common.yes', - message: 'Yes', - description: 'The label for the docs helpful button', - })} + Yes - {translate({ - id: 'theme.common.no', - message: 'No', - description: 'The label for the docs not helpful button', - })} + No )} @@ -67,6 +67,39 @@ export default function EditMetaRow({ className, editUrl }: Props): JSX.Element })} )} + {!showSuccessMessage && showTextarea && ( + <> + { + setFeedback(currentTarget.value); + }} + /> + { + void fetch(feedbackWebhookUrl, { + method: 'POST', + body: JSON.stringify({ url: window.location.href, feedback }), + }); + setShowSuccessMessage(true); + }} + > + {translate({ + id: 'theme.common.submit', + message: 'Submit', + description: 'The label of the submit button', + })} + + > + )} {editUrl && ( @@ -75,53 +108,17 @@ export default function EditMetaRow({ className, editUrl }: Props): JSX.Element Help us improve the docs! - - - - {translate({ - id: 'theme.common.editThisPage', - message: 'Edit this page', - description: 'The link label to edit the current page', - })} - - - - )} - - {!showSuccessMessage && showTextarea && ( - <> - { - setFeedback(currentTarget.value); - }} - /> - - { - window.plausible?.('Docs Not Helpful', { - props: { feedback }, - }); - setShowSuccessMessage(true); - }} - > + + {translate({ - id: 'theme.common.submit', - message: 'Submit', - description: 'The label of the submit button', + id: 'theme.common.editThisPage', + message: 'Edit this page', + description: 'The link label to edit the current page', })} - > - )} + )} + ); } diff --git a/src/theme/EditMetaRow/styles.module.scss b/src/theme/EditMetaRow/styles.module.scss index d443cc79962..37efccbc6ba 100644 --- a/src/theme/EditMetaRow/styles.module.scss +++ b/src/theme/EditMetaRow/styles.module.scss @@ -3,19 +3,26 @@ flex-direction: column; width: 100%; gap: 12px; + padding: 32px 0; + border-top: 1px solid var(--logto-line-divider); +} + +.label { + white-space: nowrap; } .flexRow { width: 100%; display: flex; justify-content: space-between; - gap: 12px; + gap: 24px; } .feedback { display: flex; flex-direction: column; gap: 12px; + flex: 1; } .buttons { @@ -30,16 +37,27 @@ padding: 0 12px; height: 36px; + svg { + color: var(--logto-color-text-secondary); + } + &.notHelpful { border: 1px solid var(--logto-container-on-danger); color: var(--logto-container-on-danger); background: var(--logto-container-danger-bg); + + svg { + color: var(--logto-container-on-danger); + } } } .feedbackInput { width: 100%; + height: 110px; + min-width: 300px; max-width: 420px; + margin-top: 8px; } .successMessage { @@ -56,17 +74,14 @@ flex-direction: column; gap: 12px; align-items: flex-end; + min-width: 200px; } -@media (max-width: 996px) { +@media (max-width: 1172px) { .flexRow { flex-direction: column; } - .buttons { - margin-bottom: 12px; - } - .successMessage { margin-bottom: 12px; }