we-insights-react-native
Version:
[we-insights] is a powerful utility library designed to streamline data collection processes for WeApp employees. It simplifies the process of gathering, storing, and managing data within WeApp projects, making it an invaluable tool for enhancing efficien
82 lines • 2.43 kB
JavaScript
import React from 'react';
import { View, Text, StyleSheet, Pressable } from 'react-native';
import { ratingIcons } from './constants';
export const Rating = ({
projectName,
selectedIconIndex,
setSelectedIconIndex,
isCustomTranslation,
translations,
customIcons,
style
}) => {
const styles = StyleSheet.create({
wrapper: {
backgroundColor: style.backgroundColor,
borderRadius: 8,
padding: 16
},
text: {
color: style.textColor,
fontFamily: style.primaryFont,
fontSize: 16,
lineHeight: 22,
marginLeft: 8,
marginRight: 8,
marginBottom: 16,
fontWeight: '700'
},
iconWrapper: {
display: 'flex',
flexDirection: 'column',
alignItems: 'center'
},
iconContent: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between'
},
paragraph: {
color: style.iconTextColor,
fontFamily: style.secondaryFont,
textAlign: 'center',
maxWidth: 60,
height: 50,
marginTop: 4
}
});
const icons = customIcons || ratingIcons;
const {
one,
two,
three,
four,
five
} = translations.ratingTranslations;
return /*#__PURE__*/React.createElement(View, {
style: styles.wrapper
}, /*#__PURE__*/React.createElement(Text, {
style: styles.text
}, isCustomTranslation ? translations.satisfactionQuestion : translations.satisfactionQuestion + projectName, "?"), /*#__PURE__*/React.createElement(View, {
style: styles.iconContent
}, icons.map(({
Icon,
IconSelected
}, index) => /*#__PURE__*/React.createElement(Pressable, {
style: styles.iconWrapper,
key: index,
onPress: () => setSelectedIconIndex(index + 1)
}, selectedIconIndex === index + 1 ? /*#__PURE__*/React.createElement(IconSelected, null) : /*#__PURE__*/React.createElement(Icon, null), index === 0 && /*#__PURE__*/React.createElement(Text, {
style: styles.paragraph
}, one), index === 1 && /*#__PURE__*/React.createElement(Text, {
style: styles.paragraph
}, two), index === 2 && /*#__PURE__*/React.createElement(Text, {
style: styles.paragraph
}, three), index === 3 && /*#__PURE__*/React.createElement(Text, {
style: styles.paragraph
}, four), index === 4 && /*#__PURE__*/React.createElement(Text, {
style: styles.paragraph
}, five)))));
};
//# sourceMappingURL=Rating.js.map