115 lines
3.0 KiB
TypeScript
115 lines
3.0 KiB
TypeScript
import React from "react";
|
|
import { ScrollView, StyleSheet } from "react-native";
|
|
|
|
import type { DetailRendererProps } from "../../types/renderer.types";
|
|
|
|
import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
|
|
import { Hero } from "../shared/Hero";
|
|
import { SectionCard } from "../shared/SectionCard";
|
|
import { Paragraphs } from "../shared/Paragraphs";
|
|
import { asString } from "../helpers/value";
|
|
|
|
export function FourLevelsDetailRenderer({
|
|
content,
|
|
data,
|
|
definitions,
|
|
presentationAttributes,
|
|
}: DetailRendererProps) {
|
|
const title =
|
|
asString(data.name) ||
|
|
asString(data.title) ||
|
|
content.title;
|
|
|
|
const overview = asString(data.overview);
|
|
const clinicalManifestations =
|
|
asString(data.clinical_menifestation) ||
|
|
asString(data.clinical_manifestations);
|
|
const tongue = asString(data.tongue);
|
|
const pulse = asString(data.pulse);
|
|
const pathology = asString(data.pathology);
|
|
const treatmentPrinciple =
|
|
asString(data.treatment_principle) ||
|
|
asString(data["treatment principle"]);
|
|
const treatment = asString(data.treatment);
|
|
const explanation = asString(data.explanation);
|
|
const contentText = asString(data.content);
|
|
|
|
return (
|
|
<ScrollView
|
|
contentContainerStyle={styles.content}
|
|
showsVerticalScrollIndicator={false}
|
|
>
|
|
<Hero title={title} />
|
|
|
|
{overview ? (
|
|
<SectionCard title="Overview">
|
|
<Paragraphs items={[overview]} />
|
|
</SectionCard>
|
|
) : null}
|
|
|
|
{clinicalManifestations ? (
|
|
<SectionCard title="Clinical Manifestations">
|
|
<Paragraphs items={[clinicalManifestations]} />
|
|
</SectionCard>
|
|
) : null}
|
|
|
|
{tongue ? (
|
|
<SectionCard title="Tongue">
|
|
<Paragraphs items={[tongue]} />
|
|
</SectionCard>
|
|
) : null}
|
|
|
|
{pulse ? (
|
|
<SectionCard title="Pulse">
|
|
<Paragraphs items={[pulse]} />
|
|
</SectionCard>
|
|
) : null}
|
|
|
|
{pathology ? (
|
|
<SectionCard title="Pathology">
|
|
<Paragraphs items={[pathology]} />
|
|
</SectionCard>
|
|
) : null}
|
|
|
|
{treatmentPrinciple ? (
|
|
<SectionCard title="Treatment Principle">
|
|
<Paragraphs items={[treatmentPrinciple]} />
|
|
</SectionCard>
|
|
) : null}
|
|
|
|
{treatment ? (
|
|
<SectionCard title="Treatment">
|
|
<Paragraphs items={[treatment]} />
|
|
</SectionCard>
|
|
) : null}
|
|
|
|
{explanation ? (
|
|
<SectionCard title="Explanation">
|
|
<Paragraphs items={[explanation]} />
|
|
</SectionCard>
|
|
) : null}
|
|
|
|
{contentText ? (
|
|
<SectionCard title="Content">
|
|
<Paragraphs items={[contentText]} />
|
|
</SectionCard>
|
|
) : null}
|
|
|
|
<ContentLinkAttributeSections
|
|
data={data}
|
|
definitions={definitions}
|
|
presentationAttributes={presentationAttributes}
|
|
/>
|
|
</ScrollView>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
content: {
|
|
paddingHorizontal: 18,
|
|
paddingTop: 16,
|
|
paddingBottom: 40,
|
|
gap: 14,
|
|
},
|
|
});
|