UNPKG

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

90 lines (89 loc) 2.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Rating = void 0; var _react = _interopRequireDefault(require("react")); var _reactNative = require("react-native"); var _constants = require("./constants"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const Rating = ({ projectName, selectedIconIndex, setSelectedIconIndex, isCustomTranslation, translations, customIcons, style }) => { const styles = _reactNative.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 || _constants.ratingIcons; const { one, two, three, four, five } = translations.ratingTranslations; return /*#__PURE__*/_react.default.createElement(_reactNative.View, { style: styles.wrapper }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, { style: styles.text }, isCustomTranslation ? translations.satisfactionQuestion : translations.satisfactionQuestion + projectName, "?"), /*#__PURE__*/_react.default.createElement(_reactNative.View, { style: styles.iconContent }, icons.map(({ Icon, IconSelected }, index) => /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, { style: styles.iconWrapper, key: index, onPress: () => setSelectedIconIndex(index + 1) }, selectedIconIndex === index + 1 ? /*#__PURE__*/_react.default.createElement(IconSelected, null) : /*#__PURE__*/_react.default.createElement(Icon, null), index === 0 && /*#__PURE__*/_react.default.createElement(_reactNative.Text, { style: styles.paragraph }, one), index === 1 && /*#__PURE__*/_react.default.createElement(_reactNative.Text, { style: styles.paragraph }, two), index === 2 && /*#__PURE__*/_react.default.createElement(_reactNative.Text, { style: styles.paragraph }, three), index === 3 && /*#__PURE__*/_react.default.createElement(_reactNative.Text, { style: styles.paragraph }, four), index === 4 && /*#__PURE__*/_react.default.createElement(_reactNative.Text, { style: styles.paragraph }, five))))); }; exports.Rating = Rating; //# sourceMappingURL=Rating.js.map