/** @module @category UI */
import React, { useMemo } from 'react';
import classNames from 'classnames';
import { ExtensionSlot } from '@openmrs/esm-react-utils';
import { getCoreTranslation } from '@openmrs/esm-translations';
import { age, formatPartialDate, getPatientName } from '@openmrs/esm-utils';
import { GenderFemaleIcon, GenderMaleIcon, GenderOtherIcon, GenderUnknownIcon } from '../../icons';
import PatientBannerPatientIdentifiers from './patient-banner-patient-identifiers.component';
import styles from './patient-banner-patient-info.module.scss';
interface PatientBannerPatientInfoProps {
patient: fhir.Patient;
/**
* A unique string to identify where the PatientInfo is rendered from.
* (ex: Patient Chart, search app, etc...). This string is passed into extensions to
* affect how / if they should be rendered
*/
renderedFrom?: string;
}
type Gender = 'female' | 'male' | 'other' | 'unknown';
interface GenderIconProps {
gender: keyof typeof GENDER_ICONS;
}
const GENDER_ICONS = {
Female: GenderFemaleIcon,
Male: GenderMaleIcon,
Other: GenderOtherIcon,
Unknown: GenderUnknownIcon,
} as const;
const GenderIcon = ({ gender }: GenderIconProps) => {
const IconComponent = GENDER_ICONS[gender];
if (!IconComponent) {
return null;
}
return