Card.tsx 1.66 KB
Newer Older
1
2
3
import * as React from 'react';
import * as moment from 'moment';

4
5
6
7
8
9
import { Dataset } from 'model/dataset.model';

import Card, { CardHeader, CardContent } from 'material-ui/Card';
import Divider from 'material-ui/Divider';
import { Link } from 'react-router';

10
import Markdown from 'ui/common/markdown';
11
12
import { PartnerLink } from 'ui/catalog/Links';
import { Properties, PropertiesItem } from 'ui/catalog/Properties';
13

14
interface IDatasetCardProps extends React.ClassAttributes<any> {
15
16
  className?: string;
  dataset: Dataset;
17
18
}

19
class DatasetCard extends React.Component<IDatasetCardProps, any> {
20
21

    public render() {
22
        const { dataset, className } = this.props;
23

24
25
26
        if (! dataset) {
          return null;
        }
27
28

        return (
29
            <Card className={ className } square>
30
31
32
                <CardHeader
                    title={
                        (
Maxim Babichev's avatar
Maxim Babichev committed
33
                            <Link to={ '/datasets/' + dataset.uuid }>
34
                                <Markdown basic source={ dataset.title } />
35
36
37
38
39
40
                            </Link>
                        )
                    }
                />
                <Divider />
                <CardContent>
41
42
43
44
45
                    <Markdown className="mb-20" textLength={ 200 } source={ dataset.description } />
                    <Properties>
                      <PropertiesItem title="Data provider:"><PartnerLink to={ dataset.owner } /></PropertiesItem>
                      <PropertiesItem title="Upload date:">{ moment(dataset.createdDate).format('D MMMM YYYY') }</PropertiesItem>
                    </Properties>
46
47
48
                </CardContent>
            </Card>
        );
Matija Obreza's avatar
Matija Obreza committed
49
    }
50
51
}

52
export default DatasetCard;