From 0e837fe4f3017e6cd10cbb119760240627cc93a9 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Fri, 24 Apr 2026 01:56:23 +0700 Subject: [PATCH] chore(lint): hoist inline style arrays in question-form-card --- .../app/src/components/question-form-card.tsx | 108 +++++++++++------- 1 file changed, 65 insertions(+), 43 deletions(-) diff --git a/packages/app/src/components/question-form-card.tsx b/packages/app/src/components/question-form-card.tsx index 87bfaca9c..82170f66a 100644 --- a/packages/app/src/components/question-form-card.tsx +++ b/packages/app/src/components/question-form-card.tsx @@ -1,4 +1,4 @@ -import { useState, useCallback } from "react"; +import { useState, useCallback, useMemo } from "react"; import { View, Text, @@ -106,17 +106,22 @@ function QuestionOptionRow({ [isSelected, theme.colors.surface2], ); + const optionLabelStyle = useMemo( + () => [styles.optionLabel, { color: theme.colors.foreground }], + [theme.colors.foreground], + ); + const optionDescriptionStyle = useMemo( + () => [styles.optionDescription, { color: theme.colors.foregroundMuted }], + [theme.colors.foregroundMuted], + ); + return ( - - {option.label} - + {option.label} {option.description ? ( - - {option.description} - + {option.description} ) : null} {isSelected ? ( @@ -151,18 +156,29 @@ function QuestionOtherInput({ }, [onChange, qIndex], ); - return ( - + [ styles.otherInput, { borderColor: value.length > 0 ? theme.colors.borderAccent : theme.colors.border, color: theme.colors.foreground, backgroundColor: theme.colors.surface2, }, - // @ts-expect-error - outlineStyle is web-only - IS_WEB && { outlineStyle: "none", outlineWidth: 0, outlineColor: "transparent" }, - ]} + IS_WEB ? { outlineStyle: "none", outlineWidth: 0, outlineColor: "transparent" } : null, + ] as const, + [ + value.length, + theme.colors.borderAccent, + theme.colors.border, + theme.colors.foreground, + theme.colors.surface2, + ], + ); + return ( + [ + styles.container, + { + backgroundColor: theme.colors.surface1, + borderColor: theme.colors.border, + }, + ], + [theme.colors.surface1, theme.colors.border], + ); + const questionTextStyle = useMemo( + () => [styles.questionText, { color: theme.colors.foreground }], + [theme.colors.foreground], + ); + const actionsContainerStyle = useMemo( + () => [styles.actionsContainer, !isMobile && styles.actionsContainerDesktop], + [isMobile], + ); + const dismissActionTextStyle = useMemo( + () => [styles.actionText, { color: theme.colors.foregroundMuted }], + [theme.colors.foregroundMuted], + ); + const submitActionTextColor = allAnswered + ? theme.colors.foreground + : theme.colors.foregroundMuted; + const submitActionTextStyle = useMemo( + () => [styles.actionText, { color: submitActionTextColor }], + [submitActionTextColor], + ); + if (!questions) { return null; } return ( - + {questions.map((q, qIndex) => { const selected = selections[qIndex] ?? new Set(); const otherText = otherTexts[qIndex] ?? ""; @@ -320,9 +358,7 @@ export function QuestionFormCard({ permission, onRespond, isResponding }: Questi return ( - - {q.question} - + {q.question} @@ -350,16 +386,14 @@ export function QuestionFormCard({ permission, onRespond, isResponding }: Questi ); })} - + {respondingAction === "dismiss" ? ( ) : ( - - Dismiss - + Dismiss )} @@ -369,20 +403,8 @@ export function QuestionFormCard({ permission, onRespond, isResponding }: Questi ) : ( - - - Submit - + + Submit )}