UNPKG

ux-personal-info-card

Version:

75 lines (72 loc) 3.07 kB
import "core-js/modules/es6.object.assign"; import "core-js/modules/es6.function.name"; import React, { useMemo } from 'react'; import * as styles from './style.st'; import AvatarCmp from 'ux-feature-avatar'; import TodoItem from './components/todo-item'; import CardItem from './components/card-item'; import NoTodo from './components/no-todos'; var App = function App(props) { var getAvatarComData = function getAvatarComData() { var userInfo = props.userInfo, size = props.size, _props$simpleMode = props.simpleMode, simpleMode = _props$simpleMode === void 0 ? true : _props$simpleMode, _props$medalurl = props.medalurl, medalurl = _props$medalurl === void 0 ? '' : _props$medalurl, _props$blessingType = props.blessingType, blessingType = _props$blessingType === void 0 ? 1 : _props$blessingType, _props$decorationType = props.decorationType, decorationType = _props$decorationType === void 0 ? 1 : _props$decorationType, _props$showHonorCard = props.showHonorCard, showHonorCard = _props$showHonorCard === void 0 ? false : _props$showHonorCard; var avatarConfig = { name: userInfo.name, avatar: { hasAvatar: userInfo.avatar.hasAvatar, img: userInfo.avatar.img, color: userInfo.avatar.color }, size: size, simpleMode: simpleMode, blessingType: blessingType, medalurl: medalurl, decorationType: decorationType, showHonorCard: showHonorCard, udc: { medal: { ext: { type: "medal", desc: "view-wall", from: "homePage-avatar" } }, bless: { type: "bless", "from": "homePage", to: userInfo.id } } }; return avatarConfig; }; var renderTodoList = useMemo(function () { return React.createElement(styles.ListWrap, null, props.todoList && props.todoList.map(function (item, index) { return React.createElement(TodoItem, Object.assign({}, item, { key: item.appId, index: index })); }), props.todoList && props.todoList.length == 0 && React.createElement(NoTodo, { historyTodos: props.historyTodos })); }, [props.todoList, props.historyTodos]); var renderCardList = useMemo(function () { return React.createElement(styles.CardListWrap, null, props.cardList && props.cardList.map(function (item, index) { return React.createElement(CardItem, Object.assign({}, item, { key: item.id })); })); }, [props.cardList]); return React.createElement(styles.Wrap, null, React.createElement(styles.CardTop, null, React.createElement(styles.AvatarWap, null, React.createElement(AvatarCmp, Object.assign({}, getAvatarComData()))), renderCardList, React.createElement(styles.TopBack, null)), React.createElement(styles.CardBottom, null, React.createElement(styles.BottomTopBack, null), renderTodoList), "\u8FD9\u662F\u4E2A\u4EBA\u4FE1\u606F\u5361\u7247\u7EC4\u4EF6"); }; export default App;