style(ui): add generic divider lines before nested object sections

This commit is contained in:
ShivaniKhaire 2026-10-23 14:05:13 +05:30
parent c1dc542975
commit a05c3c71b1
5 changed files with 40 additions and 6 deletions

View File

@ -36,7 +36,7 @@ export const DivergentChannel = ({ data }: { data: Record<string, unknown> }) =>
export const LuoChannel = ({ data }: { data: Record<string, unknown> }) => (
<SectionCard title="Luo-Connecting Channel">
<BulletList items={asStringArray(data.luo_connecting_channel)} />
<ObjectSections value={asRecord(data.luo_connecting_vessel)} />
<ObjectSections value={asRecord(data.luo_connecting_vessel)} withTopDivider />
</SectionCard>
);

View File

@ -145,7 +145,10 @@ export function MeridianDetailRenderer({
<>
<BulletList items={asStringArray(value)} />
{isPresent(data.luo_connecting_vessel) ? (
<ObjectSections value={asRecord(data.luo_connecting_vessel)} />
<ObjectSections
value={asRecord(data.luo_connecting_vessel)}
withTopDivider
/>
) : null}
</>
);

View File

@ -592,6 +592,9 @@ const styles = StyleSheet.create({
},
subSectionSpacing: {
marginTop: verticalScale(12),
paddingTop: verticalScale(12),
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: "#E8ECEF",
},
subSectionTitle: {
fontSize: moderateScale(13),

View File

@ -131,7 +131,13 @@ export function ContentValue({
};
return (
<View key={key} style={styles.objectRow}>
<View
key={key}
style={[
styles.objectRow,
index > 0 && styles.divider,
]}
>
<Text style={styles.objectLabel}>{humanizeKey(key)}</Text>
{renderChild()}
</View>
@ -177,6 +183,11 @@ const styles = StyleSheet.create({
objectRow: {
gap: 4,
},
divider: {
paddingTop: 12,
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: "#E8ECEF",
},
objectLabel: {
fontSize: 12,
lineHeight: 17,

View File

@ -9,7 +9,13 @@ import { ContentValue } from "./ContentValue";
* content references. ContentValue recursively handles arrays, objects and
* hydrated content/template references.
*/
export function ObjectSections({ value }: { value: Record<string, unknown> }) {
export function ObjectSections({
value,
withTopDivider = false,
}: {
value: Record<string, unknown>;
withTopDivider?: boolean;
}) {
const entries = Object.entries(value).filter(([, child]) =>
isPresent(child),
);
@ -18,8 +24,14 @@ export function ObjectSections({ value }: { value: Record<string, unknown> }) {
return (
<View style={styles.root}>
{entries.map(([key, child]) => (
<View key={key} style={styles.section}>
{entries.map(([key, child], index) => (
<View
key={key}
style={[
styles.section,
(index > 0 || withTopDivider) && styles.divider,
]}
>
<Text style={styles.label}>{humanizeKey(key)}</Text>
<ContentValue value={child} />
</View>
@ -40,6 +52,11 @@ function isPresent(value: unknown): boolean {
const styles = StyleSheet.create({
root: { gap: 16 },
section: { gap: 7 },
divider: {
paddingTop: 12,
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: "#E8ECEF",
},
label: {
fontWeight: "700",
fontSize: 13,