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

This commit is contained in:
ShivaniKhaire 2026-10-23 12:16:28 +05:30
parent dc1659b44a
commit da7e3e0bea
3 changed files with 28 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

@ -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>
@ -39,7 +51,14 @@ function isPresent(value: unknown): boolean {
const styles = StyleSheet.create({
root: { gap: 16 },
section: { gap: 7 },
section: {
gap: 7,
},
divider: {
paddingTop: 12,
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: "#E8ECEF",
},
label: {
fontWeight: "700",
fontSize: 13,