From 61661390a6e41f19c3fdd22f6eddcb067a489abd Mon Sep 17 00:00:00 2001 From: vivekjain23 <165671934+vivekjain23@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:44:27 +0530 Subject: [PATCH] feat(docs) : Feedback Form for documentation (#3327) * Add Feedback Form Component --- .../src/components/FeedbackForm/index.tsx | 62 +++++++++++++++++++ .../src/components/FeedbackForm/styles.css | 56 +++++++++++++++++ docs/site/src/theme/MDXContent/index.tsx | 8 ++- 3 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 docs/site/src/components/FeedbackForm/index.tsx create mode 100644 docs/site/src/components/FeedbackForm/styles.css diff --git a/docs/site/src/components/FeedbackForm/index.tsx b/docs/site/src/components/FeedbackForm/index.tsx new file mode 100644 index 00000000000..8613ffdf7a3 --- /dev/null +++ b/docs/site/src/components/FeedbackForm/index.tsx @@ -0,0 +1,62 @@ +import React, { useState } from 'react'; +import clsx from "clsx"; +import "./styles.css"; + +const FeedbackForm = () => { + const [title, setTitle] = useState(''); + const [body, setBody] = useState(''); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + + const prefixedTitle = `Docs feedback: ${title}`; + const githubNewIssueUrl = `https://github.com/iotaledger/devx/issues/new?template=doc-bug.md&title=${encodeURIComponent(prefixedTitle)}&body=${encodeURIComponent(body)}`; + + // Open the GitHub issue page with pre-filled data in a new tab + window.open(githubNewIssueUrl, '_blank'); + setTitle(""); + setBody(""); + }; + + return ( +
+
+
Feedback Form
+
+
+ + setTitle(e.target.value)} + required + className="input-field" + placeholder='Enter Title' + /> +
+
+ +