All checks were successful
continuous-integration/drone/push Build is passing
Start our journey into turning GeneIT as afully featured family intranet by making genealogy a feature that can be disabled by family admins Reviewed-on: #175
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { mdiCross } from "@mdi/js";
|
|
import {
|
|
ListItemAvatar,
|
|
ListItemButton,
|
|
ListItemSecondaryAction,
|
|
ListItemText,
|
|
} from "@mui/material";
|
|
import { Member, fmtDate } from "../api/genealogy/MemberApi";
|
|
import { MemberPhoto } from "./MemberPhoto";
|
|
import Icon from "@mdi/react";
|
|
import FemaleIcon from "@mui/icons-material/Female";
|
|
import MaleIcon from "@mui/icons-material/Male";
|
|
|
|
export function MemberItem(p: {
|
|
dense?: boolean;
|
|
member?: Member;
|
|
onClick?: () => void;
|
|
secondary?: React.ReactElement;
|
|
}): React.ReactElement {
|
|
return (
|
|
<ListItemButton onClick={p.onClick} dense={p.dense}>
|
|
<ListItemAvatar>
|
|
<MemberPhoto member={p.member!} />
|
|
</ListItemAvatar>
|
|
<ListItemText
|
|
primary={
|
|
<>
|
|
{p.member?.fullName}{" "}
|
|
{p.member?.sex === "F" ? (
|
|
<FemaleIcon fontSize="small" htmlColor="pink" />
|
|
) : (
|
|
<MaleIcon fontSize="small" htmlColor="lightBlue" />
|
|
)}{" "}
|
|
{p.member?.dead && <Icon path={mdiCross} size={"1rem"} />}
|
|
</>
|
|
}
|
|
secondary={
|
|
p.member?.dead
|
|
? `${fmtDate(p.member?.dateOfBirth)} - ${fmtDate(
|
|
p.member?.dateOfDeath
|
|
)}`
|
|
: fmtDate(p.member?.dateOfBirth)
|
|
}
|
|
/>
|
|
{p.secondary && (
|
|
<ListItemSecondaryAction>{p.secondary}</ListItemSecondaryAction>
|
|
)}
|
|
</ListItemButton>
|
|
);
|
|
}
|