Aucune description

test-71997d3e.js.map 6.6KB

1
  1. {"version":3,"file":"test-3e7def9a.js","sources":["../src/components/Common/test.tsx"],"sourcesContent":["import React, { PureComponent } from \"react\";\r\nimport classnames from 'classnames';\r\n\r\nimport styles from './test.less';\r\n\r\nexport const ImgRowList = (\r\n imglist: Array<string>,\r\n outterKey: string,\r\n type: string | null = 'normal',\r\n) => {\r\n if (!imglist || !Array.isArray(imglist)) return null;\r\n return (\r\n <div\r\n className={classnames(styles.normal_img_row_list, {\r\n [styles.middle_type]: type === 'middle',\r\n })}\r\n >\r\n {imglist.map((image_url: string, index: number) => {\r\n return (\r\n <span key={`${outterKey}_${image_url}`}>\r\n <img src={image_url} alt={`comment ${index}`} />\r\n </span>\r\n );\r\n })}\r\n </div>\r\n );\r\n};\r\n\r\ninterface MyNormalListProps {\r\n style?: any;\r\n renderItem: Function | any;\r\n renderData: Array<any>;\r\n}\r\nexport class MyNormalList extends PureComponent<MyNormalListProps, {}> {\r\n render() {\r\n const {\r\n style: innerStyle = {},\r\n renderItem = () => {},\r\n renderData = [],\r\n } = this.props;\r\n\r\n if (!renderData || !Array.isArray(renderData)) {\r\n console.error('MyNormalList Components renderData Props must be Array');\r\n return null;\r\n }\r\n\r\n return (\r\n <div className={styles.normal_list_wrapper} style={innerStyle}>\r\n {renderData.map((value, index, arr) => renderItem(value, index))}\r\n </div>\r\n );\r\n }\r\n}\r\n\r\ninterface NormalCardProps {\r\n key: any;\r\n userinfo: {\r\n nickname: string | any;\r\n avatar: string | any;\r\n created: string | number;\r\n };\r\n main_content: any;\r\n append_content?: any;\r\n content_img_assets?: Array<string>;\r\n options?: {\r\n header_size?: 'small' | 'normal' | 'middle';\r\n bottom_divider?: boolean;\r\n };\r\n}\r\nexport class NormalCard extends PureComponent<NormalCardProps, {}> {\r\n render() {\r\n const {\r\n userinfo: { nickname, avatar, created } = {\r\n nickname: '',\r\n avatar: '',\r\n created: '',\r\n },\r\n main_content = null,\r\n append_content = null,\r\n content_img_assets = [],\r\n options = {\r\n header_size: 'normal',\r\n bottom_divider: false,\r\n },\r\n } = this.props;\r\n //\r\n\r\n const RENDEROPTIONS_showImgList =\r\n content_img_assets && content_img_assets.length > 0;\r\n\r\n return (\r\n <div\r\n className={classnames(styles.normal_card_wrapper, {\r\n [styles.header_middle]: options.header_size === 'middle', // default\r\n [styles.header_small]: options.header_size === 'small',\r\n [styles.bottom_border]: options.bottom_divider,\r\n })}\r\n >\r\n <time>{created}</time>\r\n <header>\r\n {typeof avatar === 'string' ? (\r\n <div className={styles.avatar_wrapper}>\r\n <img src={avatar} alt=\"user_avatar\" />\r\n </div>\r\n ) : (\r\n avatar\r\n )}\r\n <div className={styles.nickname_wrapper}>{nickname}</div>\r\n </header>\r\n <div className={styles.main_content_wrapper}>\r\n {main_content}\r\n {RENDEROPTIONS_showImgList\r\n ? ImgRowList(content_img_assets, this.props.key)\r\n : null}\r\n </div>\r\n <div className={styles.append_wrapper}>{append_content}</div>\r\n </div>\r\n );\r\n }\r\n}\r\n\r\ninterface ShareCardProps {\r\n isMobile: boolean | any;\r\n mode: 'line' | 'block';\r\n render_mode: 'text' | 'object';\r\n share_data: any;\r\n}\r\nexport class ShareCard extends PureComponent<ShareCardProps, {}> {\r\n render() {\r\n const {\r\n isMobile = false,\r\n render_mode = 'text',\r\n mode = 'line',\r\n share_data = '',\r\n } = this.props;\r\n\r\n return (\r\n <div\r\n className={classnames(styles.share_card_wrapper, {\r\n [styles.mobile_mode]: isMobile,\r\n [styles.mode_line]: mode === 'line', // default\r\n [styles.mode_block]: mode === 'block',\r\n })}\r\n >\r\n {render_mode === 'text' ? share_data : null}\r\n </div>\r\n );\r\n }\r\n}\r\n\r\n// type TransmitType = 'imgTxt' | 'shortVideo' | 'microVideo';\r\n// type TransmitImgTxtData = {\r\n// user_id?: string|number;\r\n// anonymity?: boolean;\r\n// avatar?: string;\r\n// nickname?: string;\r\n// is_long?: boolean;\r\n// }\r\n\r\n// interface TransmitCardProps {\r\n// type: TransmitType;\r\n// data: TransmitImgTxtData;\r\n// }\r\n\r\n// export class TransmitCard extends React.PureComponent<TransmitCardProps, {}> {\r\n// renderVideo() {\r\n// return <div className={styles.transmitVideoCard}>Video</div>;\r\n// }\r\n\r\n// renderImgTxt() {\r\n// const { data } = this.props;\r\n// const {\r\n// user_id,\r\n// anonymity,\r\n// avatar,\r\n// nickname,\r\n// is_long,\r\n// } = data;\r\n\r\n// return (\r\n// <div className={styles.transmitImgTxtCard}>\r\n// <div className={styles.header}>\r\n// <UserLink user_id={user_id} anonymity={anonymity}>\r\n// <Avatar\r\n// id={user_id}\r\n// image={avatar}\r\n// follow={false}\r\n// size=\"cover\"\r\n// className={styles.ava}\r\n// anonymity={anonymity}\r\n// />\r\n// </UserLink>\r\n// <div className={styles.nickname}>\r\n// <UserLink user_id={user_id} anonymity={anonymity}>\r\n// {nickname}\r\n// </UserLink>\r\n// </div>\r\n// <div className={styles.type}>\r\n// {is_long\r\n// ? intl.get('bilingually.imgtxt.article')\r\n// : intl.get('bilingually.imgtxt')}\r\n// </div>\r\n// </div>\r\n// </div>\r\n// );\r\n// }\r\n\r\n// render() {\r\n// const { type } = this.props;\r\n// if (type === 'imgTxt') {\r\n// this.renderImgTxt();\r\n// }\r\n// if (type === 'shortVideo' || type === 'microVideo') {\r\n// this.renderVideo();\r\n// }\r\n// return null;\r\n// }\r\n// }\r\n\r\nexport const Test = \"TestComponent\";\r\nexport const TestRedTxt = () => (\r\n <div className={styles.red}>\r\n RedTxt\r\n </div>\r\n)\r\n\r\nexport default {\r\n MyNormalList,\r\n NormalCard,\r\n ShareCard,\r\n Test,\r\n // TransmitCard\r\n};"],"names":["Test"],"mappings":";;;;;;;;;;AAuJA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,IAAaA,IAAI,GAAG,eAAb;;;;"}