@livelike/react-native
Version:
LiveLike React Native package
59 lines • 1.52 kB
JavaScript
import React, { useMemo } from 'react';
import { StyleSheet, View } from 'react-native';
import { useStyles, useTheme } from '../../hooks';
import { BannerType } from '../../types';
import { LLText } from '../LLText';
export function LLChatBannerItem(_ref) {
let {
message,
type,
styles: stylesProp
} = _ref;
const {
theme
} = useTheme();
const bannerItemStyles = useStyles({
componentStylesFn: getAppBannerItemStyles,
stylesProp
});
const themeIndicatorColor = useMemo(() => ({
[BannerType.INFO]: theme.info,
[BannerType.ERROR]: theme.error
}), [theme]);
return /*#__PURE__*/React.createElement(View, {
style: bannerItemStyles.itemContainer
}, /*#__PURE__*/React.createElement(View, {
style: [{
backgroundColor: themeIndicatorColor[type]
}, bannerItemStyles.bannerIndicator]
}), /*#__PURE__*/React.createElement(LLText, {
style: bannerItemStyles.bannerText
}, message));
}
const getAppBannerItemStyles = _ref2 => {
let {
theme
} = _ref2;
return StyleSheet.create({
itemContainer: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
height: 45,
minWidth: 200,
backgroundColor: theme.popoverBackground,
marginBottom: 10
},
bannerIndicator: {
width: 5,
height: '100%',
marginRight: 10
},
bannerText: {
paddingRight: 10,
color: theme.text
}
});
};
//# sourceMappingURL=LLChatBannerItem.js.map