UNPKG

react-native-shakeyos-cards

Version:

Chat component for React Native

94 lines (93 loc) 2.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _reactNative = require("react-native"); var AgentCard = function AgentCard(_ref) { var _agent$name; var style = _ref.style, _ref$agent = _ref.agent, agent = _ref$agent === void 0 ? [] : _ref$agent, onPress = _ref.onPress; return /*#__PURE__*/React.createElement(_reactNative.View, { style: [styles.cardContainer, style] }, /*#__PURE__*/React.createElement(_reactNative.Text, { style: styles.agentName }, agent === null || agent === void 0 ? void 0 : agent.name), /*#__PURE__*/React.createElement(_reactNative.View, { style: styles.agentIconContainer }, /*#__PURE__*/React.createElement(_reactNative.Text, { style: styles.agentInitials }, (agent === null || agent === void 0 || (_agent$name = agent.name) === null || _agent$name === void 0 || (_agent$name = _agent$name.split(" ")) === null || _agent$name === void 0 || (_agent$name = _agent$name.map(function (word) { return word[0]; })) === null || _agent$name === void 0 || (_agent$name = _agent$name.join("")) === null || _agent$name === void 0 ? void 0 : _agent$name.toUpperCase()) || "RN")), /*#__PURE__*/React.createElement(_reactNative.View, { style: styles.footerContainer }, /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, { style: styles.chatButton, onPress: onPress }, /*#__PURE__*/React.createElement(_reactNative.Text, { style: styles.chatButtonText }, "Chat")))); }; var styles = _reactNative.StyleSheet.create({ cardContainer: { backgroundColor: "#1e1e1e", padding: 16, borderRadius: 12, marginVertical: 8, shadowColor: "#000", shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.3, shadowRadius: 4.65, elevation: 8 }, agentName: { fontSize: 18, color: "#fff", marginBottom: 12, textTransform: "capitalize" }, agentIconContainer: { backgroundColor: "#333", height: 100, width: 100, borderRadius: 8, justifyContent: "center", alignItems: "center", alignSelf: "center", marginBottom: 16 }, agentInitials: { fontSize: 28, color: "#fff", fontWeight: "bold" }, footerContainer: { alignItems: "center" }, chatButton: { backgroundColor: "#444", paddingHorizontal: 20, paddingVertical: 10, borderRadius: 8, width: "100%", alignItems: "center" }, chatButtonText: { color: "#fff", fontSize: 16 }, settingsButton: { backgroundColor: "#444", padding: 10, borderRadius: 8 }, settingsIcon: { color: "#fff", fontSize: 16 } }); var _default = exports["default"] = AgentCard;