Skip to content

Commit

Permalink
Utilize consistent syntax for fallback text rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
samau3 committed Oct 30, 2024
1 parent fa5bf99 commit 1de0930
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,35 @@ export default function MedicalInfo({ allergies, medications, conditions }) {
<Paper shadow="xs" p="md" radius="md" withBorder>
<section>
<Text className={classes.boldText}>Allergies</Text>
{allergies.length === 0 && <Text>None</Text>}
{allergies.map((entry) => (
<Pill
size="md"
key={entry.allergy.id}
className={classes.medicalInfoPills}
>
{entry.allergy.name}
</Pill>
))}
{allergies.length === 0 ? (
<Text>None</Text>
) : (
allergies.map((entry) => (
<Pill
size="md"
key={entry.allergy.id}
className={classes.medicalInfoPills}
>
{entry.allergy.name}
</Pill>
))
)}
</section>
<section>
<Text className={classes.boldText}>Medications</Text>
{medications.length === 0 && <Text>None</Text>}
{medications.map((entry) => (
<Pill
size="md"
key={entry.medication.id}
className={classes.medicalInfoPills}
>
{entry.medication.name}
</Pill>
))}
{medications.length === 0 ? (
<Text>None</Text>
) : (
medications.map((entry) => (
<Pill
size="md"
key={entry.medication.id}
className={classes.medicalInfoPills}
>
{entry.medication.name}
</Pill>
))
)}
</section>
<section>
<Text className={classes.boldText}>Conditions</Text>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import { Paper, Text } from '@mantine/core';
import classes from '../PatientDetails.module.css';

import { humanize } from 'inflection';
const preferencesProps = {
codeStatus: PropTypes.string,
hospital: PropTypes.object,
Expand All @@ -20,9 +20,9 @@ export default function Preferences({ codeStatus, hospital }) {
<Paper shadow="xs" p="md" radius="md" withBorder>
<section>
<Text className={classes.boldText}>Code status</Text>
<Text>{codeStatus || 'Not provided'}</Text>
<Text>{codeStatus ? humanize(codeStatus) : 'Not provided'}</Text>
<Text className={classes.boldText}>Hospital</Text>
<Text>{hospital?.name}</Text>
<Text>{hospital ? hospital.name : 'Not provided'}</Text>
</section>
</Paper>
</section>
Expand Down

0 comments on commit 1de0930

Please sign in to comment.