import React from "react"; import { StyleSheet, Text, View } from "react-native"; import { humanizeKey } from "../helpers/value"; import { ContentValue } from "./ContentValue"; export function RecordCards({ rows, titleKey = "name", }: { rows: Record[]; titleKey?: string; }) { if (!rows.length) return null; return ( {rows.map((row, index) => ( {typeof row[titleKey] === "string" && String(row[titleKey]).trim() ? ( {String(row[titleKey])} ) : null} {Object.entries(row).filter(([key]) => key !== titleKey && key !== "code").map(([key, value]) => ( {humanizeKey(key)} ))} ))} ); } const styles = StyleSheet.create({ list: { gap: 10 }, card: { borderWidth: 1, borderColor: "#E1E8E4", borderRadius: 14, padding: 13, gap: 10, backgroundColor: "#FAFCFB", }, title: { fontSize: 16, lineHeight: 22, fontWeight: "700", color: "#294C3B", }, field: { gap: 4 }, label: { fontSize: 12, lineHeight: 17, fontWeight: "700", color: "#617468", textTransform: "uppercase", letterSpacing: 0.35, }, value: { fontSize: 15, lineHeight: 23, color: "#334155" }, });