From cfe9a4d9bfdada73b6988c0dfdd42597e0838f96 Mon Sep 17 00:00:00 2001 From: alexcss Date: Thu, 31 Oct 2024 13:49:17 +0200 Subject: [PATCH 1/5] Request an article Form --- docusaurus.config.js | 8 ++ src/components/FeedbackForm/index.js | 160 +---------------------- src/components/ModalFormSpark/index.js | 172 +++++++++++++++++++++++++ src/components/RequestArticle/index.js | 32 +++++ src/theme/DocItem/MoreActions/index.js | 6 + src/theme/Icon/Article/index.js | 15 +++ 6 files changed, 237 insertions(+), 156 deletions(-) create mode 100644 src/components/ModalFormSpark/index.js create mode 100644 src/components/RequestArticle/index.js create mode 100644 src/theme/Icon/Article/index.js diff --git a/docusaurus.config.js b/docusaurus.config.js index 360aa0f2..ad386a9a 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -44,6 +44,14 @@ const config = { title: 'Report an Issue', url : 'https://github.com/rsksmart/devportal/issues', }, + requestArticle : { + title: 'Request an Article', + form : { + id : '5qQ40ScPu', + title : 'Request an Article', + description : 'Please provide a detailed description of the article you would like to see on the Devportal.', + } + }, } }, // GitHub pages deployment config. diff --git a/src/components/FeedbackForm/index.js b/src/components/FeedbackForm/index.js index 8174d0a4..778eb1d9 100644 --- a/src/components/FeedbackForm/index.js +++ b/src/components/FeedbackForm/index.js @@ -1,160 +1,7 @@ -import React, {useState, useEffect} from "react"; +import React, {useState} from "react"; import Translate from '@docusaurus/Translate'; -import Modal from 'react-bootstrap/Modal'; -import {useFormspark} from "@formspark/use-formspark"; -function MyVerticallyCenteredModal(props) { - const [url, setUrl] = useState('#'); - - const [submit, submitting] = useFormspark({ - formId: `vg6LeINWT`, - }); - - const [message, setMessage] = useState(""); - const [email, setEmail] = useState(""); - const [name, setName] = useState(""); - - const [sending, setSending] = useState(false); - const [submitted, setSubmitted] = useState(false); - - const totalStars = 5; - const [rating, setRating] = useState(props.rating || 0); - const [hover, setHover] = useState(null); - - useEffect(() => { - setRating(props.rating); - - if (window) { - setUrl(window.location.origin + window.location.pathname); - } - }, [props.rating, props.show]); - - const onSubmit = async (e) => { - if (submitting) return; - - e.preventDefault(); - setSending(true); - await submit( - {message, email, name, rating, url} - ); - setSubmitted(true); - setSending(false); - setMessage(""); - setEmail(""); - setName(""); - setRating(0); - setTimeout(() => { - setSubmitted(false); - }, 4000) - }; - - return ( - - - - - Thank you for your feedback! - -

We would love to hear your thoughts and feedback so that we can improve these Docs for you and others!

-
- Current rating -
- {[...Array(totalStars)].map((star, index) => { - const currentRating = index + 1; - - return ( - - ); - })} -
-
-
-
- - setName(e.target.value)} - /> - setEmail(e.target.value)} - /> - -