diff --git a/app/components/Textarea.tsx b/app/components/Textarea.tsx index 7d89cdef6..0809d7aba 100644 --- a/app/components/Textarea.tsx +++ b/app/components/Textarea.tsx @@ -32,7 +32,9 @@ const Textarea = ({ id: name, placeholder, })} - className={classNames("ds-textarea", { "has-error": error })} + className={classNames("ds-textarea placeholder-gray-600", { + "has-error": error, + })} aria-invalid={error !== undefined} aria-describedby={error && errorId} aria-errormessage={error && errorId} diff --git a/app/components/UserFeedback.tsx b/app/components/UserFeedback.tsx deleted file mode 100644 index 7027b5f36..000000000 --- a/app/components/UserFeedback.tsx +++ /dev/null @@ -1,92 +0,0 @@ -import Heading from "./Heading"; -import Button from "./Button"; -import ThumbUpIcon from "@mui/icons-material/ThumbUpOutlined"; -import ThumbDownIcon from "@mui/icons-material/ThumbDownOutlined"; -import ButtonContainer from "./ButtonContainer"; -import Background from "./Background"; -import Container from "./Container"; -import { useState, useEffect } from "react"; -import RichText from "./RichText"; -import { useFetcher, useLocation } from "@remix-run/react"; - -export const wasHelpfulFieldname = "wasHelpful"; - -type UserFeedbackProps = { - heading: string; - yesButtonLabel: string; - noButtonLabel: string; - successHeading: string; - successText: string; - showSuccess: boolean; - context?: string | undefined; -}; - -export default function UserFeedback({ - heading, - yesButtonLabel, - noButtonLabel, - successHeading, - successText, - showSuccess, - context, -}: Readonly) { - const url = useLocation().pathname; - const wasHelpfulFetcher = useFetcher(); - const [jsAvailable, setJsAvailable] = useState(false); - useEffect(() => setJsAvailable(true), []); - - return ( - - -
- {showSuccess ? ( - <> - - - - ) : ( - <> - - - - - - - - - )} -
-
-
- ); -} diff --git a/app/components/UserFeedback/FeedbackFormBox.tsx b/app/components/UserFeedback/FeedbackFormBox.tsx new file mode 100644 index 000000000..74e8d5cd1 --- /dev/null +++ b/app/components/UserFeedback/FeedbackFormBox.tsx @@ -0,0 +1,83 @@ +import { z } from "zod"; +import { withZod } from "@remix-validated-form/with-zod"; +import { ValidatedForm } from "remix-validated-form"; +import CloseIcon from "@mui/icons-material/CloseOutlined"; +import SendIcon from "@mui/icons-material/SendOutlined"; +import Button from "../Button"; +import ButtonContainer from "../ButtonContainer"; +import Heading from "../Heading"; +import Textarea from "../Textarea"; + +export const feedbackFormName = "feedbackForm"; +const feedbackFieldname = "feedback"; +const feedbackButtonFieldname = "feedbackButton"; + +enum FeedbackButtons { + Abort = "abort", + Submit = "submit", +} + +export const feedbackValidator = withZod( + z.object({ + feedback: z + .string() + .refine( + (feedback) => !/\s0\d/.test(feedback), + "Bitte geben sie keine Telefonnummer ein.", + ) + .refine( + (feedback) => !feedback.includes("@"), + "Bitte geben sie keine E-Mailadresse ein.", + ), + }), +); + +export interface FeedbackBoxProps { + destination: string; + heading: string; + placeholder: string; + abortButtonLabel: string; + submitButtonLabel: string; +} + +export const FeedbackFormBox = ({ + destination, + heading, + placeholder, + abortButtonLabel, + submitButtonLabel, +}: FeedbackBoxProps) => ( + <> + + +
+