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