import classnames from 'classnames' import React from 'react' import { Text, View } from '@tarojs/components' import { Calendar } from '../../../../../types/calendar' import * as constant from '../../common/constant' const MAP: { [key: number]: string } = { [constant.TYPE_PRE_MONTH]: 'pre', [constant.TYPE_NOW_MONTH]: 'now', [constant.TYPE_NEXT_MONTH]: 'next' } export interface Props { list: Calendar.List onClick?: (item: Calendar.Item) => void onLongClick?: (item: Calendar.Item) => void } export default class AtCalendarList extends React.Component { private handleClick = (item: Calendar.Item): void => { if (typeof this.props.onClick === 'function') { this.props.onClick(item) } } private handleLongClick = (item: Calendar.Item): void => { if (typeof this.props.onLongClick === 'function') { this.props.onLongClick(item) } } public render(): JSX.Element | null { const { list } = this.props if (!list || list.length === 0) return null return ( {list.map((item: Calendar.Item) => ( {item.text} {item.marks && item.marks.length > 0 ? ( {item.marks.map((mark, key) => ( {mark} ))} ) : null} ))} ) } }