import React from 'react'; import classNames from 'classnames'; import { ReactionsRecords, UR } from 'getstream'; import { ReactionIcon, ReactionIconProps } from './ReactionIcon'; import { DefaultUT } from '../context/StreamApp'; import { PropsWithElementAttributes } from '../utils'; type ReactionToggleIconProps< UT extends DefaultUT = DefaultUT, RT extends UR = UR, CRT extends UR = UR > = PropsWithElementAttributes< { /** The icon to show when the user has done this reaction (e.g. a filled in heart) */ activeIcon: ReactionIconProps['icon']; /** The icon to show when the user has not done this reaction yet (e.g. an empty in heart) */ inactiveIcon: ReactionIconProps['icon']; /** The map with own reactions */ own_reactions?: ReactionsRecords | Record; } & Omit >; export const ReactionToggleIcon = ({ inactiveIcon, activeIcon, own_reactions: ownReactions, kind, className, style, ...restProps }: ReactionToggleIconProps) => { const icon = ownReactions?.[kind ?? '']?.length ? activeIcon : inactiveIcon; return (
); };