import React from 'react'

import { EyeOutlined } from '@ant-design/icons'

import { IResearchsummaryItem } from 'Newest/Newest.service'
import styles from '../css/ItemComponent.module.scss'
import { IItemType } from './Item.component'
export interface ISummaryCardProps {
  item: IResearchsummaryItem
  itemType: IItemType
  title?: string // 标红的标题
}
/**本周/上周汇总卡片组件 */
const SummaryCard: React.FC<ISummaryCardProps> = props => {
  const { item, itemType, title } = props
  const handleToDetail = () => {
    window.open(`/summary/${itemType === IItemType.Researchsummary ? 2 : 3}/${item.ArticleId}`)
  }
  if (!item) return null
  return (
    <div className={styles['item-article']} onClick={handleToDetail}>
      <div className="item-article-title">
        <div
          className="item-article-title-content"
          dangerouslySetInnerHTML={{
            __html: title || item.Title
          }}
        />
      </div>
      <div className={`item-article-annotation line-seven`}>
        <div dangerouslySetInnerHTML={{ __html: item.Abstract }} />
      </div>
      <div className="item-time-right item-article-flex">
        <div className="item-article-pv">
          <EyeOutlined size={14} className="pv-icon" />
          <span>{item.Pv || 0}</span>
        </div>
        <div className="item-article-publistdate">{item.PublishDate}</div>
      </div>
    </div>
  )
}

export default SummaryCard
