From f0ed429ceebd95b83d8acf66007b9282a5c573db Mon Sep 17 00:00:00 2001 From: m-tartari <37861893+m-tartari@users.noreply.github.com> Date: Tue, 10 Feb 2026 16:10:13 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(people):=20add=20employee=20de?= =?UTF-8?q?tails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/EmployeeDescription/index.tsx | 68 ++++++++ .../molecules/EmplyeeCard/index.tsx | 34 +++- .../molecules/EmplyeeStack/index.tsx | 11 +- src/components/pages/PeoplePage/index.tsx | 161 ++++++++++++++++-- 4 files changed, 248 insertions(+), 26 deletions(-) create mode 100644 src/components/molecules/EmployeeDescription/index.tsx diff --git a/src/components/molecules/EmployeeDescription/index.tsx b/src/components/molecules/EmployeeDescription/index.tsx new file mode 100644 index 0000000..ffefa7a --- /dev/null +++ b/src/components/molecules/EmployeeDescription/index.tsx @@ -0,0 +1,68 @@ +import { Dialog, DialogProps, DialogTitle, DialogContent, IconButton, Typography, Stack, Divider } from '@mui/material' +import CloseIcon from '@mui/icons-material/Close' + +export type EmployeeDescription = { + title: string + position?: string + image?: string + body?: string[] + captions?: string[] +} + +export type EmployeeDescriptionDialogProps = DialogProps & { + description: EmployeeDescription +} + +const EmployeeDescriptionDialog: React.FC = ({ description, ...props }) => ( + + + + {description.title} + + {description.position && ( + + {description.position} + + )} + + } + sx={{ + position: 'absolute', + right: 0, + top: 0, + }}> + + + + {description.title} + {description.body && + description.body.map((paragraph, idx) => ( + + {paragraph} + + ))} + {description.captions && ( + <> + + + {description.captions.map((caption, idx) => ( + + {caption} + + ))} + + + )} + + +) + +export default EmployeeDescriptionDialog diff --git a/src/components/molecules/EmplyeeCard/index.tsx b/src/components/molecules/EmplyeeCard/index.tsx index a467949..122d042 100644 --- a/src/components/molecules/EmplyeeCard/index.tsx +++ b/src/components/molecules/EmplyeeCard/index.tsx @@ -1,16 +1,28 @@ -import { Card, CardContent, CardMedia, CardProps, Typography } from '@mui/material' -import { FC } from 'react' +import { FC, useMemo } from 'react' +import { Card, CardActionArea, CardContent, CardMedia, CardProps, Typography } from '@mui/material' -export interface EmplyeeCardProps extends CardProps { +import { EmployeeDescription } from 'components/molecules/EmployeeDescription/index.js' + +export type EmployeeCardProps = Omit & { name: string image: string position?: string + description?: Partial + onClick?: (event: React.MouseEvent, description: EmployeeDescription) => void } -export const EmplyeeCard: FC = ({ name, position, image, sx, ...props }) => { - return ( - - +export const EmplyeeCard: FC = ({ name, position, image, description = {}, sx, onClick, ...props }) => { + const handleClick = (event: React.MouseEvent) => { + onClick(event, { + title: name, + image: image, + position: position, + ...description, + }) + } + const content = useMemo( + () => [ + , {name} @@ -20,7 +32,13 @@ export const EmplyeeCard: FC = ({ name, position, image, sx, . {position} )} - + , + ], + [name, position, image] + ) + return ( + + {content} ) } diff --git a/src/components/molecules/EmplyeeStack/index.tsx b/src/components/molecules/EmplyeeStack/index.tsx index bc56e91..b7a8c5b 100644 --- a/src/components/molecules/EmplyeeStack/index.tsx +++ b/src/components/molecules/EmplyeeStack/index.tsx @@ -1,10 +1,13 @@ import { FC, useEffect, useState } from 'react' import { Box, IconButton } from '@mui/material' -import { EmplyeeCard, EmplyeeCardProps } from 'components/molecules/EmplyeeCard/index.js' import ShuffleIcon from '@mui/icons-material/NextPlan' +import { EmplyeeCard, EmployeeCardProps } from 'components/molecules/EmplyeeCard/index.js' +import { EmployeeDescription } from 'components/molecules/EmployeeDescription/index.js' + interface Props { - items: EmplyeeCardProps[] + items: EmployeeCardProps[] + onClick?: (event: React.MouseEvent, description: EmployeeDescription) => void // Visual offsets offsetStep?: number // px shift per card @@ -15,6 +18,7 @@ const EmplyeeStack: FC = ({ offsetStep = 10, // px shift per card maxVisible = 6, // how many cards we actually render (performance) items: initialItems, + onClick, }) => { const [items, setItems] = useState(initialItems) @@ -29,7 +33,7 @@ const EmplyeeStack: FC = ({ } if (items.length === 0) return null - if (items.length === 1) return + if (items.length === 1) return return ( = ({ {items.slice(0, maxVisible).map((props, idx) => ( { + const [description, setDescription] = useState(null) + + const handleCardClick = (e: React.MouseEvent, description: EmployeeDescription) => { + e.stopPropagation() + setDescription(description) + } + const handleClose = () => { + setDescription(null) + } return ( @@ -33,9 +163,10 @@ const ProjectsPage = () => { {people.map((props, idx) => ( - + ))} + ) }