UNPKG

@sendbird/uikit-react-native-foundation

Version:

A foundational UI kit for building chat-enabled React Native apps.

110 lines 2.99 kB
import React from 'react'; import { conditionChaining, truncatedCount } 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'; const OpenChannelPreview = ({ customCover, coverUrl, participantsCount = 0, title, frozen }) => { const { colors } = useUIKitTheme(); const color = colors.ui.openChannelPreview.default.none; return /*#__PURE__*/React.createElement(Box, { backgroundColor: color.background, width: '100%', height: 62, flexDirection: 'row', alignItems: 'center', paddingHorizontal: 16 }, /*#__PURE__*/React.createElement(Box, { width: styles.channelCover.width, height: styles.channelCover.height, borderRadius: styles.channelCover.width, overflow: 'hidden', marginEnd: 16 }, conditionChaining([Boolean(customCover)], [customCover, /*#__PURE__*/React.createElement(Image, { resizeMode: 'cover', style: [styles.channelCover, { backgroundColor: color.coverBackground }], source: { uri: coverUrl } })])), /*#__PURE__*/React.createElement(Box, { flex: 1, height: '100%', justifyContent: 'center' }, /*#__PURE__*/React.createElement(Box, { flexDirection: 'row', flexShrink: 1, marginBottom: 4, alignItems: 'center' }, /*#__PURE__*/React.createElement(Text, { subtitle1: true, style: styles.channelInfoTitle, numberOfLines: 1, color: color.textTitle }, title), frozen && /*#__PURE__*/React.createElement(Icon, { size: 16, icon: 'freeze', color: color.frozenIcon, containerStyle: styles.marginStart })), /*#__PURE__*/React.createElement(Box, { flexDirection: 'row', flexShrink: 1, alignItems: 'center', justifyContent: 'flex-start' }, /*#__PURE__*/React.createElement(Box, { flexDirection: 'row', alignItems: 'center' }, /*#__PURE__*/React.createElement(Icon, { size: 16, icon: 'members', color: color.participantsIcon, containerStyle: styles.marginEnd }), /*#__PURE__*/React.createElement(Text, { caption2: true, color: color.textParticipants }, truncatedCount(participantsCount, 999)))), /*#__PURE__*/React.createElement(Separator, { color: color.separator }))); }; const Separator = ({ color }) => /*#__PURE__*/React.createElement(Box, { style: [styles.separator, { backgroundColor: color }] }); const styles = createStyleSheet({ channelCover: { width: 32, height: 32 }, channelInfoTitle: { flexShrink: 1 }, marginEnd: { marginEnd: 4 }, marginStart: { marginStart: 4 }, separator: { position: 'absolute', start: 0, end: -16, bottom: 0, height: 1 } }); export default OpenChannelPreview; //# sourceMappingURL=index.js.map