import React from 'react';
import {inject, observer} from 'mobx-react';
import {
  Card,
} from 'antd';
import NumberFormat from 'react-number-format';
import {Link} from 'react-router-dom';
import {LINKS} from "../../../routes";
import {appConfig} from "../../../config/app";
import get from 'lodash.get';
import {Collapse} from "react-collapse";

@inject('appstate')
@observer
export class ItemCard extends React.Component {
  constructor(props) {
    super(props);
    this.props = props;
    this.state = {};
    this.defaultState = Object.assign({}, this.state);

    this.http = props.appstate.http;
  }

  componentDidMount() {
    // console.log('ItemCard');
  }

  render() {
    const {data = {}} = this.props;

    let image = get(data, 'images.logo', '');

    if (!image.includes('http')) {
      image = this.http.appendImagePath(image);
    }

    return (
      <Card className={'itemCard'}>
        <img className={'imageCard'} src={image}/>
        <p className={'titleCard'}>{data.name}</p>
      </Card>
    )
  }

}
