import { View } from "@tarojs/components";
import { FC } from "@tarojs/taro";
import classNames from "classnames";
import "./index.scss";

export interface RecordsProps {
  list: any[];
}

export const Records: FC<RecordsProps> = ({ list }) => {
  return (
    <View className="records">
      {!list.length && <View className="records__nomore">暂无记录</View>}

      {list.map((item) => (
        <View key={item.id} className="records-item">
          <View className="records-item__lf">
            <View className="records-item__lf__label">{item.type}</View>
            <View className="records-item__lf__date">{item.createTime}</View>
          </View>

          <View
            className={classNames("records-item__rg", { red: item.score < 0 })}
          >
            {item.score > 0 ? "+" : ""}
            {item.score}
          </View>
        </View>
      ))}
    </View>
  );
};
