import * as React from 'react'; import { Props, State } from './type'; import { Container, Divider } from './index.style'; import { ItemType, isShareReadItem } from './type'; import { ShareReadItem } from './components/shareread-item'; import { BookItem } from './components/book-item'; export class SnailShareReadNew extends React.Component { public static defaultProps = new Props(); public state = new State(); /** * 显示所有共读项 */ public showAll() { this.setState({ showAll: true, }) } public render() { const { style, shareReadList, isEdit, showCount, } = this.props; const { showAll } = this.state; // console.log('shareReadList', shareReadList, style); return ( { shareReadList.length ?
{ shareReadList.map((item: ItemType, index) => { if(showCount > 0 && showCount < shareReadList.length && !showAll) { return index < showCount ? (
{ isShareReadItem(item) ? : } { index < showCount - 1 ? : null}
) : null } else { return (
{ isShareReadItem(item) ? : } { index !== shareReadList.length - 1 ? : null}
) } }) }
{ showCount > 0 && showCount < shareReadList.length && !showAll ?
: null }
: isEdit &&
蜗牛共读2021版
}
) } }