Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: Feedback question not visible on bright backgrounds

Ashish Viradiya02922ce0d4b4
diff --git a/components/view/PagesViewer.tsx b/components/view/PagesViewer.tsx
index fdc42c32..be543bcb 100644
--- a/components/view/PagesViewer.tsx
+++ b/components/view/PagesViewer.tsx
@@ -348,6 +348,7 @@ export default function PagesViewer({
{enableQuestion && feedback && pageNumber === numPagesWithFeedback ? (
<div className="flex w-full items-center justify-center">
<Question
+ accentColor={brand?.accentColor}
feedback={feedback}
viewId={viewId}
submittedFeedback={submittedFeedback}
diff --git a/components/view/PagesViewerNew.tsx b/components/view/PagesViewerNew.tsx
index 50b7df76..4dd432b1 100644
--- a/components/view/PagesViewerNew.tsx
+++ b/components/view/PagesViewerNew.tsx
@@ -1013,6 +1013,7 @@ export default function PagesViewer({
style={{ height: "calc(100dvh - 64px)" }}
>
<Question
+ accentColor={brand?.accentColor}
feedback={feedback}
viewId={viewId}
submittedFeedback={submittedFeedback}
diff --git a/components/view/question.tsx b/components/view/question.tsx
index 045867a6..668049e9 100644
--- a/components/view/question.tsx
+++ b/components/view/question.tsx
@@ -5,6 +5,7 @@ import { motion } from "motion/react";
import { STAGGER_CHILD_VARIANTS } from "@/lib/constants";
import { cn } from "@/lib/utils";
+import { determineTextColor } from "@/lib/utils/determine-text-color";
export default function Question({
feedback,
@@ -12,12 +13,14 @@ export default function Question({
submittedFeedback,
setSubmittedFeedback,
isPreview,
+ accentColor,
}: {
feedback: { id: string; data: { question: string; type: string } };
viewId?: string;
submittedFeedback: boolean;
setSubmittedFeedback: (submittedFeedback: boolean) => void;
isPreview?: boolean;
+ accentColor?: string | null;
}) {
const [answer, setAnswer] = useState<"yes" | "no" | "">("");
@@ -70,7 +73,12 @@ export default function Question({
variants={STAGGER_CHILD_VARIANTS}
className="flex flex-col items-center space-y-10 text-center"
>
- <h1 className="font-display max-w-lg text-3xl font-semibold text-white transition-colors sm:text-4xl">
+ <h1
+ className="font-display max-w-lg text-3xl font-semibold transition-colors sm:text-4xl"
+ style={{
+ color: accentColor ? determineTextColor(accentColor) : "white",
+ }}
+ >
Thanks for your feedback!
</h1>
</motion.div>
@@ -100,19 +108,37 @@ export default function Question({
variants={STAGGER_CHILD_VARIANTS}
className="flex w-full flex-col items-center space-y-10 text-center"
>
- <h1 className="font-display max-w-xl text-3xl font-semibold text-white transition-colors sm:text-4xl">
+ <h1
+ className="font-display max-w-xl text-3xl font-semibold transition-colors sm:text-4xl"
+ style={{
+ color: accentColor ? determineTextColor(accentColor) : "white",
+ }}
+ >
{feedback.data.question}
</h1>
</motion.div>
<motion.div
variants={STAGGER_CHILD_VARIANTS}
- className="grid w-full max-w-sm grid-cols-1 divide-y divide-border rounded-md border border-border text-white md:grid-cols-2 md:divide-x md:divide-y-0"
+ className="grid w-full max-w-sm grid-cols-1 divide-y rounded-md border border-border md:grid-cols-2 md:divide-x md:divide-y-0"
+ style={{
+ color: accentColor ? determineTextColor(accentColor) : "white",
+ borderColor: accentColor
+ ? determineTextColor(accentColor)
+ : "hsl(var(--border))",
+ }}
>
<button
onClick={() => handleQuestionSubmit("yes")}
className={cn(
- "flex min-h-[200px] flex-col items-center justify-center space-y-5 overflow-hidden p-5 transition-colors hover:bg-gray-200 hover:text-black hover:dark:bg-gray-800 md:p-10",
- answer === "yes" ? "bg-gray-200 dark:bg-gray-800" : "",
+ "flex min-h-[200px] flex-col items-center justify-center space-y-5 overflow-hidden p-5 transition-colors md:p-10",
+ determineTextColor(accentColor) === "black"
+ ? "hover:bg-gray-800 hover:text-gray-200"
+ : "hover:bg-gray-200 hover:text-gray-800",
+ answer === "yes"
+ ? determineTextColor(accentColor) === "black"
+ ? "bg-gray-800 text-gray-200"
+ : "bg-gray-200 text-gray-800"
+ : "",
)}
>
<ThumbsUpIcon
@@ -124,8 +150,15 @@ export default function Question({
<button
onClick={() => handleQuestionSubmit("no")}
className={cn(
- "flex min-h-[200px] flex-col items-center justify-center space-y-5 overflow-hidden p-5 transition-colors hover:bg-gray-200 hover:text-black hover:dark:bg-gray-800 md:p-10",
- answer === "no" ? "bg-gray-200 dark:bg-gray-800" : "",
+ "flex min-h-[200px] flex-col items-center justify-center space-y-5 overflow-hidden p-5 transition-colors md:p-10",
+ determineTextColor(accentColor) === "black"
+ ? "hover:bg-gray-800 hover:text-gray-200"
+ : "hover:bg-gray-200 hover:text-gray-800",
+ answer === "no"
+ ? determineTextColor(accentColor) === "black"
+ ? "bg-gray-800 text-gray-200"
+ : "bg-gray-200 text-gray-800"
+ : "",
)}
>
<ThumbsDownIcon
diff --git a/components/view/viewer/pages-horizontal-viewer.tsx b/components/view/viewer/pages-horizontal-viewer.tsx
index 751153fd..67bd4caa 100644
--- a/components/view/viewer/pages-horizontal-viewer.tsx
+++ b/components/view/viewer/pages-horizontal-viewer.tsx
@@ -725,6 +725,7 @@ export default function PagesHorizontalViewer({
style={{ height: "calc(100dvh - 64px)" }}
>
<Question
+ accentColor={brand?.accentColor}
feedback={feedback}
viewId={viewId}
submittedFeedback={submittedFeedback}
diff --git a/components/view/viewer/pages-vertical-viewer.tsx b/components/view/viewer/pages-vertical-viewer.tsx
index 3438bc22..727ed93b 100644
--- a/components/view/viewer/pages-vertical-viewer.tsx
+++ b/components/view/viewer/pages-vertical-viewer.tsx
@@ -877,6 +877,7 @@ export default function PagesVerticalViewer({
style={{ height: "calc(100dvh - 64px)" }}
>
<Question
+ accentColor={brand?.accentColor}
feedback={feedback}
viewId={viewId}
submittedFeedback={submittedFeedback}