Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/view/PagesViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
1 change: 1 addition & 0 deletions components/view/PagesViewerNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ export default function PagesViewer({
style={{ height: "calc(100dvh - 64px)" }}
>
<Question
accentColor={brand?.accentColor}
feedback={feedback}
viewId={viewId}
submittedFeedback={submittedFeedback}
Expand Down
47 changes: 40 additions & 7 deletions components/view/question.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ 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,
viewId,
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" | "">("");

Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions components/view/viewer/pages-horizontal-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@ export default function PagesHorizontalViewer({
style={{ height: "calc(100dvh - 64px)" }}
>
<Question
accentColor={brand?.accentColor}
feedback={feedback}
viewId={viewId}
submittedFeedback={submittedFeedback}
Expand Down
1 change: 1 addition & 0 deletions components/view/viewer/pages-vertical-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ export default function PagesVerticalViewer({
style={{ height: "calc(100dvh - 64px)" }}
>
<Question
accentColor={brand?.accentColor}
feedback={feedback}
viewId={viewId}
submittedFeedback={submittedFeedback}
Expand Down