import React from 'react'; import { conditionChaining } from '@sendbird/uikit-utils'; import Box from '../../components/Box'; import Icon from '../../components/Icon'; import Image from '../../components/Image'; import Text from '../../components/Text'; import createStyleSheet from '../../styles/createStyleSheet'; import useUIKitTheme from '../../theme/useUIKitTheme'; import Badge from '../Badge'; type Props = { customCover?: React.ReactNode; coverUrl: string; title: string; titleCaption: string; titleCaptionLeft?: React.ReactNode; bodyIcon?: keyof typeof Icon.Assets; body: string; memberCount?: number; badgeCount: number; maxBadgeCount?: number; frozen?: boolean; notificationOff?: boolean; broadcast?: boolean; mentioned?: boolean; mentionTrigger?: string; }; const GroupChannelPreview = ({ customCover, coverUrl, memberCount, badgeCount, maxBadgeCount, body, bodyIcon, title, titleCaption, titleCaptionLeft, frozen, notificationOff, broadcast, mentioned, mentionTrigger = '@', }: Props) => { const { colors } = useUIKitTheme(); const color = colors.ui.groupChannelPreview; return ( {conditionChaining( [Boolean(customCover)], [ customCover, , ], )} {broadcast && ( )} {title} {Boolean(memberCount) && ( {memberCount} )} {frozen && ( )} {notificationOff && } {titleCaptionLeft} {titleCaption} {bodyIcon && ( )} {body} {mentioned && ( {mentionTrigger} )} {badgeCount > 0 && } ); }; type SeparatorProps = { color: string }; const Separator = ({ color }: SeparatorProps) => ; const styles = createStyleSheet({ container: { height: 76, width: '100%', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', }, coverContainer: { marginStart: 16, marginEnd: 16, }, channelCover: { width: 56, height: 56, borderRadius: 28, }, rightSection: { flex: 1, paddingTop: 10, paddingEnd: 16, }, rightTopSection: { flexDirection: 'row', marginBottom: 4, }, channelInfoContainer: { flex: 1, marginEnd: 4, alignItems: 'center', flexDirection: 'row', }, channelInfoBroadcast: { marginEnd: 4, }, channelInfoTitle: { flexShrink: 1, marginEnd: 4, }, channelInfoMemberCount: { paddingTop: 2, marginEnd: 4, }, channelInfoFrozen: { marginEnd: 4, }, titleCaptionContainer: { alignItems: 'flex-start', flexDirection: 'row', marginStart: 4, }, titleCaptionText: { marginTop: 2, }, rightBottomSection: { flex: 1, height: '100%', flexDirection: 'row', }, body: { marginEnd: 4, flex: 1, flexDirection: 'row', alignItems: 'flex-start', }, bodyWrapper: { flexDirection: 'row', alignItems: 'center', }, bodyIcon: { borderRadius: 8, width: 26, height: 26, marginEnd: 4, }, unreadContainer: { flexDirection: 'row', alignItems: 'flex-start', }, unreadMention: { marginEnd: 4, }, separator: { position: 'absolute', start: 0, end: -16, bottom: 0, height: 1, }, }); export default GroupChannelPreview;