import cs from 'classnames'; import styles from '../MessageLayout.module.scss'; import type { MessageAlignmentType } from '../../../../types/message'; interface UseMessageLayoutClassesProps { isMessageOwner: boolean; alignment?: MessageAlignmentType | undefined; className?: string | undefined; isAggregated?: boolean | undefined; } export function useMessageLayoutClasses({ isMessageOwner, alignment = 'two-sided', className, isAggregated = false, }: UseMessageLayoutClassesProps) { const isRightAligned = (alignment === 'two-sided' && isMessageOwner) || (alignment === 'right'); const layoutClasses = cs( styles['message-layout'], isRightAligned ? styles['message-layout--right'] : styles['message-layout--left'], className, ); const contentClasses = cs( styles['message-layout__content'], isRightAligned ? styles['message-layout__content--right'] : styles['message-layout__content--left'], ); const headerClasses = cs( styles['message-layout__header'], isRightAligned && styles['message-layout__header--right'], ); const bodyClasses = cs( styles['message-layout__body'], isRightAligned ? styles['message-layout__body--right'] : styles['message-layout__body--left'], ); const bubbleClasses = cs( styles['message-layout__bubble'], ); const avatarClasses = cs( styles['message-layout__avatar'], isRightAligned ? styles['message-layout__avatar--right'] : styles['message-layout__avatar--left'], ); const statusClasses = cs( styles['message-layout__status'], ); return { isRightAligned, layoutClasses, contentClasses, headerClasses, bodyClasses, bubbleClasses, avatarClasses, statusClasses, }; }