'use client'; import { useMemo, useState } from 'react'; import type { CheckInPhrase } from '@/entities/session'; import { Chip } from '@/shared/ui'; interface CompactCheckInChipsProps { phrases: CheckInPhrase[]; onCheckIn: (message: string) => void; collapsedCount?: number; } export const CompactCheckInChips = ({ phrases, onCheckIn, collapsedCount = 3, }: CompactCheckInChipsProps) => { const [showAll, setShowAll] = useState(false); const visiblePhrases = useMemo(() => { if (showAll) { return phrases; } return phrases.slice(0, collapsedCount); }, [collapsedCount, phrases, showAll]); return (
{visiblePhrases.map((phrase) => ( onCheckIn(phrase.text)} className="!px-2.5 !py-1 text-[11px]" > {phrase.text} ))}
{phrases.length > collapsedCount ? ( ) : null}
); };