From 7a312c121481bfcd323f345c6cb9d8a2607a635c Mon Sep 17 00:00:00 2001 From: ShivaniKhaire Date: Sat, 7 Nov 2026 17:09:44 +0530 Subject: [PATCH] fix(twelve-channels): standardize overview card layout and theme (issue #109) - Replace custom green-themed overview card in TwelveChannelsDetailRenderer with standard OverviewCard - Ensure visual consistency with Three Burners, Qi-Blood, and other curriculum modules --- .../details/TwelveChannelsDetailRenderer.tsx | 34 +----- .../content/renderers/shared/OverviewCard.tsx | 115 ++++++++++++++++++ 2 files changed, 117 insertions(+), 32 deletions(-) create mode 100644 src/features/content/renderers/shared/OverviewCard.tsx diff --git a/src/features/content/renderers/details/TwelveChannelsDetailRenderer.tsx b/src/features/content/renderers/details/TwelveChannelsDetailRenderer.tsx index f192a18..b6cce47 100644 --- a/src/features/content/renderers/details/TwelveChannelsDetailRenderer.tsx +++ b/src/features/content/renderers/details/TwelveChannelsDetailRenderer.tsx @@ -7,6 +7,7 @@ import { Colors } from "@/theme"; import type { DetailRendererProps } from "../../types/renderer.types"; import { BackActionContext } from "../../context/BackActionContext"; import { Hero } from "../shared/Hero"; +import { OverviewCard } from "../shared/OverviewCard"; import { SectionCard } from "../shared/SectionCard"; import { Paragraphs } from "../shared/Paragraphs"; import { BulletList } from "../shared/BulletList"; @@ -613,15 +614,7 @@ export function TwelveChannelsDetailRenderer({ {/* 1. Overview Card */} - {overviewText ? ( - - - - Overview - - {overviewText} - - ) : null} + {overviewText ? : null} {/* 2. Organ vs Channel Card */} {organVsChannelText ? ( @@ -756,29 +749,6 @@ const styles = StyleSheet.create({ paddingBottom: verticalScale(40), gap: verticalScale(14), }, - overviewCard: { - backgroundColor: "#F0FDF4", - borderRadius: moderateScale(14), - borderWidth: 1, - borderColor: "#DCFCE7", - padding: moderateScale(16), - }, - overviewHeader: { - flexDirection: "row", - alignItems: "center", - marginBottom: moderateScale(8), - gap: moderateScale(6), - }, - overviewTitle: { - fontSize: moderateScale(15), - fontWeight: "700", - color: Colors.primaryDark, - }, - overviewText: { - fontSize: moderateScale(14), - color: Colors.textSecondary, - lineHeight: moderateScale(21), - }, infoCard: { backgroundColor: "#FFFFFF", borderRadius: moderateScale(14), diff --git a/src/features/content/renderers/shared/OverviewCard.tsx b/src/features/content/renderers/shared/OverviewCard.tsx new file mode 100644 index 0000000..a858784 --- /dev/null +++ b/src/features/content/renderers/shared/OverviewCard.tsx @@ -0,0 +1,115 @@ +import React from "react"; +import { + StyleProp, + StyleSheet, + Text, + TextStyle, + View, + ViewStyle, +} from "react-native"; +import { Ionicons } from "@expo/vector-icons"; +import { moderateScale, verticalScale } from "react-native-size-matters"; + +import { Colors } from "@/theme"; + +export interface OverviewCardProps { + title?: string; + icon?: keyof typeof Ionicons.glyphMap; + iconColor?: string; + iconSize?: number; + text?: string | null; + paragraphs?: Array; + children?: React.ReactNode; + style?: StyleProp; + titleStyle?: StyleProp; + textStyle?: StyleProp; +} + +export function OverviewCard({ + title = "Overview", + icon = "information-circle", + iconColor = Colors.primary, + iconSize = moderateScale(20), + text, + paragraphs, + children, + style, + titleStyle, + textStyle, +}: OverviewCardProps) { + const filteredParagraphs = paragraphs?.filter( + (p): p is string => typeof p === "string" && p.trim().length > 0, + ); + + const hasText = typeof text === "string" && text.trim().length > 0; + const hasParagraphs = + Array.isArray(filteredParagraphs) && filteredParagraphs.length > 0; + + if (!hasText && !hasParagraphs && !children) { + return null; + } + + return ( + + + {icon ? ( + + ) : null} + {title} + + + {hasText ? ( + {text} + ) : null} + + {hasParagraphs + ? filteredParagraphs.map((para, index) => ( + + {para} + + )) + : null} + + {children} + + ); +} + +const styles = StyleSheet.create({ + card: { + backgroundColor: "#FFFFFF", + borderRadius: moderateScale(16), + padding: moderateScale(16), + borderWidth: 1, + borderColor: "#E2EAE5", + }, + header: { + flexDirection: "row", + alignItems: "center", + gap: moderateScale(8), + marginBottom: verticalScale(8), + }, + title: { + fontSize: moderateScale(16), + fontWeight: "700", + color: Colors.textPrimary, + }, + text: { + fontSize: moderateScale(13), + lineHeight: verticalScale(20), + color: Colors.textSecondary, + }, + paragraph: { + fontSize: moderateScale(13), + lineHeight: verticalScale(20), + color: Colors.textSecondary, + marginTop: verticalScale(8), + }, +}); + -- 2.34.1