import React from "react";
import Flex from "../../../components/templates/flex";
import { Icon } from "../../../components/icon";
import { Text, TextSmall } from "../../../components/typography";
import Image from "./image";
import Anchor from "./anchor";
var Item = function Item(_ref) {
  var item = _ref.item;
  var publishedAt = item.last_publication_date,
    data = item.data;
  var title = data.title,
    description = data.description,
    url = data.url,
    image = data.image,
    label = data.label;
  var imageSrc = image && image.url;
  var dateFormated = new Date(publishedAt);
  return /*#__PURE__*/React.createElement(Flex, {
    column: true,
    gap: 2
  }, /*#__PURE__*/React.createElement(Flex, {
    gap: 4
  }, imageSrc && /*#__PURE__*/React.createElement(Image, {
    src: imageSrc,
    width: "160px"
  }), /*#__PURE__*/React.createElement(Flex, {
    column: true,
    gap: 2
  }, /*#__PURE__*/React.createElement(Text, {
    strong: true
  }, title), /*#__PURE__*/React.createElement(Text, null, description))), /*#__PURE__*/React.createElement(Flex, {
    justifyContent: "between",
    alignItems: "center"
  }, /*#__PURE__*/React.createElement(TextSmall, null, dateFormated.toLocaleDateString()), /*#__PURE__*/React.createElement(Anchor, {
    href: url,
    target: "_blank",
    rel: "noopener noreferrer",
    gap: 1,
    alignItems: "center"
  }, /*#__PURE__*/React.createElement(Text, {
    color: "success",
    strong: true
  }, label), /*#__PURE__*/React.createElement(Icon, {
    color: "success",
    rotate: 2,
    name: "arrow_left"
  }))));
};
export default Item;