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
This commit is contained in:
ShivaniKhaire 2026-11-07 17:09:44 +05:30
parent 3273d74780
commit 7a312c1214
2 changed files with 117 additions and 32 deletions

View File

@ -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({
<Hero title="Twelve Channels" />
{/* 1. Overview Card */}
{overviewText ? (
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>{overviewText}</Text>
</View>
) : null}
{overviewText ? <OverviewCard text={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),

View File

@ -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<string | null | undefined>;
children?: React.ReactNode;
style?: StyleProp<ViewStyle>;
titleStyle?: StyleProp<TextStyle>;
textStyle?: StyleProp<TextStyle>;
}
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 (
<View style={[styles.card, style]}>
<View style={styles.header}>
{icon ? (
<Ionicons name={icon} size={iconSize} color={iconColor} />
) : null}
<Text style={[styles.title, titleStyle]}>{title}</Text>
</View>
{hasText ? (
<Text style={[styles.text, textStyle]}>{text}</Text>
) : null}
{hasParagraphs
? filteredParagraphs.map((para, index) => (
<Text
key={index}
style={[
index === 0 && !hasText ? styles.text : styles.paragraph,
textStyle,
]}
>
{para}
</Text>
))
: null}
{children}
</View>
);
}
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),
},
});