Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
feat: display narrative for resources in CardContent
Browse files Browse the repository at this point in the history
  • Loading branch information
BPierrick committed Jan 27, 2022
1 parent 04f3257 commit 0428373
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/features/conditions/ConditionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useTranslation } from "react-i18next";
import DateInfo from "common/components/DateInfo";
import Tag from "common/components/Tag";
import ResourceCardActions from "features/resources/ResourceCardActions";
import ResourceCardContent from "features/resources/ResourceCardContent";
import { getResourceTagValues } from "features/resources/utils";
import { TERMINOLOGY_SYSTEM_URL } from "models/constants";

Expand Down Expand Up @@ -64,6 +65,7 @@ const ConditionCard = ({ condition }: ConditionCardProps): JSX.Element => {
</div>
}
/>
<ResourceCardContent resource={condition} />
{softwareName && (
<CardContent>
<Typography variant="caption">
Expand Down
2 changes: 2 additions & 0 deletions src/features/documentReferences/DocumentReferenceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useTranslation } from "react-i18next";
import DateInfo from "common/components/DateInfo";
import Tag from "common/components/Tag";
import ResourceCardActions from "features/resources/ResourceCardActions";
import ResourceCardContent from "features/resources/ResourceCardContent";
import { TERMINOLOGY_SYSTEM_URL } from "models/constants";

const useStyles = makeStyles((theme) => ({
Expand Down Expand Up @@ -47,6 +48,7 @@ const DocumentReferenceCard = ({
</div>
}
/>
<ResourceCardContent resource={documentReference} />
{softwareName && (
<CardContent>
<Typography variant="caption">
Expand Down
2 changes: 2 additions & 0 deletions src/features/encounters/EncounterCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useTranslation } from "react-i18next";
import DateInfo from "common/components/DateInfo";
import Tag from "common/components/Tag";
import ResourceCardActions from "features/resources/ResourceCardActions";
import ResourceCardContent from "features/resources/ResourceCardContent";
import { getResourceTagValues } from "features/resources/utils";
import { TERMINOLOGY_SYSTEM_URL } from "models/constants";

Expand Down Expand Up @@ -53,6 +54,7 @@ const EncounterCard = ({ encounter }: EncounterCardProps): JSX.Element => {
</div>
}
/>
<ResourceCardContent resource={encounter} />
{softwareName && (
<CardContent>
<Typography variant="caption">
Expand Down
2 changes: 2 additions & 0 deletions src/features/resources/ResourceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import EncounterCard from "features/encounters/EncounterCard";
import { DomainResourceList } from "models/types";

import ResourceCardActions from "./ResourceCardActions";
import ResourceCardContent from "./ResourceCardContent";
import { getResourceTagValues } from "./utils";

const useStyles = makeStyles((theme) => ({
Expand Down Expand Up @@ -55,6 +56,7 @@ const ResourceCard = ({ resource }: ResourceCardProps): JSX.Element => {
</div>
}
/>
<ResourceCardContent resource={resource} />
<ResourceCardActions resource={resource} />
</Card>
);
Expand Down
26 changes: 26 additions & 0 deletions src/features/resources/ResourceCardContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";

import { CardContent } from "@mui/material";

import InnterHTMLDiv from "common/components/InnerHTMLDiv";
import type { DomainResourceList } from "models/types";

type ResourceCardContentProps = {
resource: DomainResourceList;
};

const ResourceCardContent = ({
resource,
}: ResourceCardContentProps): JSX.Element => {
return (
<>
{resource.text?.div && (
<CardContent>
<InnterHTMLDiv innerHTML={resource.text.div} />
</CardContent>
)}
</>
);
};

export default ResourceCardContent;

0 comments on commit 0428373

Please sign in to comment.