diff --git a/src/app/year/[year]/page.tsx b/src/app/year/[year]/page.tsx index 874d354..3ab3fb7 100644 --- a/src/app/year/[year]/page.tsx +++ b/src/app/year/[year]/page.tsx @@ -16,9 +16,11 @@ export default async function YearPage({ params }: { params: Promise<{ year: str - {persons.map((person) => ( - - ))} + + {persons.map((person) => ( + + ))} + ); } diff --git a/src/components/molecules/GiftCard/index.tsx b/src/components/molecules/GiftCard/index.tsx index 46aa842..904485d 100644 --- a/src/components/molecules/GiftCard/index.tsx +++ b/src/components/molecules/GiftCard/index.tsx @@ -46,29 +46,6 @@ export const GiftCard: FC = ({ hideDetails = false, editable = fal {title} - - {link && ( - - {link.split('\n').map((line, index) => ( - e.stopPropagation()}> - Link {index + 1} - - ))} - - )} - {description && {description}} - - Data dodania: {new Date(created).toLocaleDateString()} - • - Koszt: {formatCurrency(cost)} - {!hideDetails && ( - <> - • - Dla: {expand?.person.name} - > - )} - • - Status: {formatStatus(status)} {editable && ( = ({ hideDetails = false, editable = fal )} + {description && {description}} + + Data dodania: {new Date(created).toLocaleDateString()} + Koszt: {formatCurrency(cost)} + {!hideDetails && ( + <> + • + Dla: {expand?.person.name} + > + )} + Status: {formatStatus(status)} + + {link && ( + + {link.split('\n').map((line, index) => ( + e.stopPropagation()}> + Link {index + 1} + + ))} + + )} diff --git a/src/components/molecules/PersonCard/index.tsx b/src/components/molecules/PersonCard/index.tsx index 43e1c92..36d54dd 100644 --- a/src/components/molecules/PersonCard/index.tsx +++ b/src/components/molecules/PersonCard/index.tsx @@ -1,10 +1,13 @@ +'use client'; import { Heading } from '@/components/atoms/Heading'; import { formatCurrency } from '@/helpers/formatCurrency'; -import { FC } from 'react'; +import { FC, useState } from 'react'; import { GiftCard } from '../GiftCard'; import { GiftCardAdd, PersonCardEdit } from './client'; +import { Button } from '@/components/atoms/Button'; export const PersonCard: FC = (person) => { + const [isOpen, setIsOpen] = useState(false); const { name, notes, expand } = person; const { gifts } = expand; @@ -22,15 +25,18 @@ export const PersonCard: FC = (person) => { • Koszt: {formatCurrency(gifts?.reduce((acc, gift) => acc + gift.cost, 0) || 0)} - + - Prezenty + Prezenty - + {isOpen && } + + setIsOpen(!isOpen)}> + {isOpen ? 'Mniej' : 'Więcej'} + + - {gifts?.map((gift) => ( - - ))} + {isOpen && gifts?.map((gift) => )} ); };
{description}