import React from 'react';
import './index.scss';
import dianzan from './image/dianzan.png';
import fork from './image/fork.png';

export default (props) => {
  const { list } = props;

  function itemClick(item) {
    item.url && window.open(item.url);
  }

  return (

    list.map((item, i) => {
      return (
        <div className="search-item" key={item.id}>
          <div className="search-item-tit">
            <h3 className="search-item-title" dangerouslySetInnerHTML={{ __html: item.title }} onClick={() => { itemClick(item) }}></h3>

            {item.type == 1 && <p>
              <span className="search-icon"><i className="iconfont icon-morenguanzhu_ICON mr3 font-14" />{item.watchersCount}</span>
              <span className="search-icon"><i className="iconfont icon-dianzan11 mr3 font-18" />{item.praisesCount}</span>
              <span className="search-icon"><i className="iconfont icon-fork2 mr3 font-14" />{item.forkedCount || 0}</span>
            </p>}

          </div >
          <p className="search-item-content" dangerouslySetInnerHTML={{ __html: item.content }}></p>
          <div>{item.updateTime}</div>
        </div>
      )
    })
  )
}