Skip to content

Commit

Permalink
fix(anni): cpic guideline box showing curated data
Browse files Browse the repository at this point in the history
  • Loading branch information
jannis-baum committed Jul 5, 2022
1 parent b155dff commit dee0a4b
Showing 1 changed file with 28 additions and 32 deletions.
60 changes: 28 additions & 32 deletions annotation-interface/components/annotations/CpicGuidelineBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,33 @@ const CpicSection = ({
</p>
);

const CpicGuidelineBox = ({ guideline }: { guideline: ServerGuideline }) => {
const fields: [string, string | null][] = [
['Comment', guideline.cpicComment],
[
'Phenotype consultation text',
guideline.phenotype.cpicConsultationText,
],
['Implication', guideline.implication],
['Recommendation', guideline.recommendation],
];
return (
<div className="space-y-4 border border-black border-opacity-10 p-4">
<h2 className="font-bold pb-2">
CPIC Guideline:{' '}
<a
className="underline"
href={guideline.cpicGuidelineUrl}
target="_blank"
rel="noreferrer"
>
{guideline.cpicGuidelineName}
</a>{' '}
({guideline.cpicClassification})
</h2>
{fields
.filter(([, content]) => content)
.map(([title, content], index) => (
<CpicSection key={index} title={title} content={content!} />
))}
</div>
);
};
const fields = (guideline: ServerGuideline): [string, string | null][] => [
['Comment', guideline.cpicComment],
['Phenotype consultation text', guideline.phenotype.cpicConsultationText],
['Implication', guideline.cpicImplication],
['Recommendation', guideline.cpicRecommendation],
];

const CpicGuidelineBox = ({ guideline }: { guideline: ServerGuideline }) => (
<div className="space-y-4 border border-black border-opacity-10 p-4">
<h2 className="font-bold pb-2">
CPIC Guideline:{' '}
<a
className="underline"
href={guideline.cpicGuidelineUrl}
target="_blank"
rel="noreferrer"
>
{guideline.cpicGuidelineName}
</a>{' '}
({guideline.cpicClassification})
</h2>
{fields(guideline)
.filter(([, content]) => content)
.map(([title, content], index) => (
<CpicSection key={index} title={title} content={content!} />
))}
</div>
);

export default CpicGuidelineBox;

0 comments on commit dee0a4b

Please sign in to comment.