import React, { memo } from 'react';
import { TOGGLE } from '../../../chat/styles/bubbleTokens';
interface CollapseToggleProps {
isCollapsed: boolean;
onClick: () => void;
readMoreLabel: string;
showLessLabel: string;
isUser: boolean;
isCompact: boolean;
}
/** "Read more..." / "Show less" button.
*
* Memoised: re-renders only when `isCollapsed`, `onClick`, `readMoreLabel`,
* `showLessLabel`, `isUser` or `isCompact` change. `onClick` is compared
* by reference — callers should stabilise it with useCallback.
*/
function CollapseToggleRaw({
isCollapsed,
onClick,
readMoreLabel,
showLessLabel,
isUser,
isCompact,
}: CollapseToggleProps) {
const textSize = isCompact ? 'text-xs' : 'text-sm';
return (
);
};
const Chevron = memo(function Chevron({ direction }: { direction: 'up' | 'down' }) {
return (
);
});
export const CollapseToggle = memo(CollapseToggleRaw);