acupedia-mobile-ui/src/features/content/renderers/shared/KeyValueGrid.tsx

37 lines
968 B
TypeScript

import React from "react";
import { StyleSheet, Text, View } from "react-native";
export function KeyValueGrid({ rows }: { rows: Array<{ label: string; value: string }> }) {
const visible = rows.filter((row) => row.value.trim().length > 0);
if (!visible.length) return null;
return (
<View style={styles.list}>
{visible.map((row) => (
<View key={row.label} style={styles.row}>
<Text style={styles.label}>{row.label}</Text>
<Text style={styles.value}>{row.value}</Text>
</View>
))}
</View>
);
}
const styles = StyleSheet.create({
list: { gap: 12 },
row: {
gap: 5,
paddingBottom: 10,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: "#E8ECEF",
},
label: {
fontSize: 12,
lineHeight: 17,
fontWeight: "700",
color: "#597064",
textTransform: "uppercase",
letterSpacing: 0.4,
},
value: { fontSize: 16, lineHeight: 25, color: "#334155" },
});