// import React, { useState, useEffect } from 'react'
import Taro from '@tarojs/taro'
import '@/assets/css/iconfont.css'
import { formatDate } from '@/utils/chatDate'
import './index.scss'

export default function ProjectDynamic (props) {
  const { List = [] } = props

  const info = List[0]

  const handleClick = () => {
    Taro.navigateTo({
      url: `/pages/index/buildingDynamic/index?id=${info.buildingId}`
    })
  }

  return info ? (
    <view className='components ProjectDynamic'>

      <view className='Title flex-h'>
        <view className='flex-item'>
          <text>项目动态</text>
        </view>
        <text onClick={handleClick}>更多</text>
        <text className='iconfont icon-jiantouright'></text>
      </view>

      <view className='Info' onClick={handleClick}>
        <text className='Time'>{formatDate(info.trendTime, 'yyyy-MM-dd')}</text>
        <text className='Title'>{info.trendTitle}</text>
        <text className='Desc'>{info.trendContent}</text>
      </view>

    </view>
  ) : null
}
