From 99113f093eb62f325f5383498f7a6c46c94f718a Mon Sep 17 00:00:00 2001 From: Jeff Merrick Date: Tue, 5 Sep 2023 14:31:43 -0500 Subject: [PATCH 1/2] docs: style docs feedback widget --- docs-website/src/components/Feedback/index.js | 36 +++++++----- .../src/components/Feedback/styles.module.css | 36 ------------ .../components/Feedback/styles.module.scss | 55 +++++++++++++++++++ .../src/theme/DocItem/Footer/index.js | 35 ++---------- 4 files changed, 84 insertions(+), 78 deletions(-) delete mode 100644 docs-website/src/components/Feedback/styles.module.css create mode 100644 docs-website/src/components/Feedback/styles.module.scss diff --git a/docs-website/src/components/Feedback/index.js b/docs-website/src/components/Feedback/index.js index 9a9eb1b3e9a8c..cc8310a1b5f20 100644 --- a/docs-website/src/components/Feedback/index.js +++ b/docs-website/src/components/Feedback/index.js @@ -1,6 +1,7 @@ import React, { useState } from "react"; import { supabase } from "./supabase"; -import styles from "./styles.module.css"; +import styles from "./styles.module.scss"; +import { LikeOutlined, DislikeOutlined, CheckCircleOutlined } from "@ant-design/icons"; const Feedback = ({ page }) => { const [reaction, setReaction] = useState(null); @@ -27,18 +28,27 @@ const Feedback = ({ page }) => { }; return ( -
- {reaction === null ? ( -
-

Is this page helpful?

- - -
- ) : ( -
- Thanks for your feedback! -
- )} +
+
+ {reaction === null ? ( +
+ Is this page helpful? +
+ + +
+
+ ) : ( +
+ + Thanks for your feedback! +
+ )} +
); }; diff --git a/docs-website/src/components/Feedback/styles.module.css b/docs-website/src/components/Feedback/styles.module.css deleted file mode 100644 index 098780e859889..0000000000000 --- a/docs-website/src/components/Feedback/styles.module.css +++ /dev/null @@ -1,36 +0,0 @@ -.feedbackWidget { - margin: 15px 15px; - padding: 20px 20px; - border: var(--ifm-hr-border-color) 1px solid; - border-radius: 10px; - text-align: center; -} - -.title { - text-align: center; -} - -.widget .grid { - display: flex; - flex-direction: row; - justify-content: center; - min-height: 50px; -} - -.widget .cell { - width: 50px; -} - -.reaction { - padding: 10px; -} - -.reaction:hover { - background-color: skyblue; - cursor: pointer; -} - -.widget .footer { - margin-top: 10px; - margin-left: 0; -} diff --git a/docs-website/src/components/Feedback/styles.module.scss b/docs-website/src/components/Feedback/styles.module.scss new file mode 100644 index 0000000000000..672cb18d203a1 --- /dev/null +++ b/docs-website/src/components/Feedback/styles.module.scss @@ -0,0 +1,55 @@ +.feedbackWrapper { + display: flex; +} + +.feedbackWidget { + min-height: 64px; + margin: 15px auto; + padding: 10px 20px; + border: var(--ifm-hr-border-color) 1px solid; + border-radius: 1000em; + text-align: center; + display: flex; + align-items: center; +} + +.feedbackButtons { + strong { + margin-right: 4px; + } + + display: flex; + justify-content: center; + align-items: center; + gap: 1rem; + button { + width: 2rem; + height: 2rem; + text-align: center; + font-size: 1.25rem; + padding: 0.25rem; + border-radius: 1000em; + cursor: pointer; + transition: all 0.2s ease-in-out; + svg { + fill: var(--ifm-link-color); + } + + &:hover { + background: var(--ifm-link-color); + svg { + fill: var(--ifm-background-color); + } + } + } +} + +.feedbackMessage { + display: flex; + align-items: center; + svg { + font-size: larger; + margin-right: 6px; + fill: var(--ifm-color-success); + } +} diff --git a/docs-website/src/theme/DocItem/Footer/index.js b/docs-website/src/theme/DocItem/Footer/index.js index 754f7bf4167c5..94b6c7734f9ee 100644 --- a/docs-website/src/theme/DocItem/Footer/index.js +++ b/docs-website/src/theme/DocItem/Footer/index.js @@ -10,35 +10,21 @@ import Feedback from "../../../components/Feedback"; function TagsRow(props) { return ( -
+
); } -function EditMetaRow({ - editUrl, - lastUpdatedAt, - lastUpdatedBy, - formattedLastUpdatedAt, -}) { +function EditMetaRow({ editUrl, lastUpdatedAt, lastUpdatedBy, formattedLastUpdatedAt }) { return (
{editUrl && }
{(lastUpdatedAt || lastUpdatedBy) && ( - + )}
@@ -46,14 +32,7 @@ function EditMetaRow({ } export default function DocItemFooter() { const { metadata } = useDoc(); - const { - editUrl, - lastUpdatedAt, - formattedLastUpdatedAt, - lastUpdatedBy, - tags, - unversionedId, - } = metadata; + const { editUrl, lastUpdatedAt, formattedLastUpdatedAt, lastUpdatedBy, tags, unversionedId } = metadata; const canDisplayTagsRow = tags.length > 0; const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy); const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow; @@ -62,10 +41,7 @@ export default function DocItemFooter() { } return ( <> - -