import {Image, Cell} from '@nutui/nutui-react-taro'
import {View, Text} from '@tarojs/components'
import Taro from '@tarojs/taro'

const ArticleList = (props: any) => {

  return (
    <>
      <View className={'px-3'}>
        {props.data.map((item: any, index: number) => {
          return (
            <Cell
              title={
                <View>
                  <View className="text-base font-medium mb-1">{item.title}</View>
                  {item.comments && (
                    <Text className="text-sm text-gray-500 leading-relaxed">
                      {item.comments}
                    </Text>
                  )}
                </View>
              }
              extra={
                <Image src={item.image} mode={'aspectFit'} lazyLoad={false} width={100} height="100"/>
              }
              key={index}
              onClick={() => Taro.navigateTo({url: '/cms/detail/index?id=' + item.articleId})}
            />
          )
        })}
      </View>
    </>
  )
}
export default ArticleList
