PartnerCard.tsx 2.25 KB
Newer Older
Valeriy Panov's avatar
Valeriy Panov committed
1
import * as React from 'react';
2
import { withStyles } from 'material-ui/styles';
3
import Card, { CardHeader, CardContent } from 'ui/common/Card';
Matija Obreza's avatar
Matija Obreza committed
4
import { PartnerLink } from 'ui/catalog/Links';
Valeriy Panov's avatar
Valeriy Panov committed
5

6
import { Partner } from 'model/partner.model';
7
import Markdown from 'ui/catalog/markdown';
8
import PrettyDate from 'ui/common/time/PrettyDate';
9
// import { Properties, PropertiesItem } from 'ui/catalog/Properties';
Valeriy Panov's avatar
Valeriy Panov committed
10
11
12
13
14
15

interface IPartnerCardProps extends React.ClassAttributes<any> {
    partner: Partner;
    classes: any;
}

16
17
const styles = (theme) => ({
    /* tslint:disable */
Valeriy Panov's avatar
Valeriy Panov committed
18
19
    leftBorder: {
        borderLeft: 'solid 1px #eee',
20
21
22
23
        padding: '10px 5px 20px 20px',
        '& > h1': {
            fontSize: '30px',
            marginTop: '3px',
Maxim Babichev's avatar
Maxim Babichev committed
24
            color: '#006CB4',
25
26
27
28
        },
        [theme.breakpoints.down('md')]: {
            padding: '7px 5px 7px 10px',
        },
Valeriy Panov's avatar
Valeriy Panov committed
29
    },
30
    /* tslint:enable */
Valeriy Panov's avatar
Valeriy Panov committed
31
32
    italic: {
        fontStyle: 'italic',
33
        color: '#4d4c46',
Valeriy Panov's avatar
Valeriy Panov committed
34
    },
Maxim Babichev's avatar
Maxim Babichev committed
35
36
    margin: {
      marginLeft: '2px',
37
38
39
40
41
42
43
44
    },
    grayBackgroundWrapper: {
        flexWrap: 'nowrap',
        marginBottom: '20px',
        [theme.breakpoints.down('md')]: {
            flexWrap: 'wrap',
        },
    },
45
    titleCard: {
Maxim Babichev's avatar
Maxim Babichev committed
46
        marginBottom: '20px',
47
48
49
50
51
        [theme.breakpoints.down('md')]: {
            fontSize: '20px',
            lineHeight: '25px',
        },
    },
52
});
Valeriy Panov's avatar
Valeriy Panov committed
53
54
55
56
57
58

class PartnerCard extends React.Component<IPartnerCardProps, any> {

    public render() {
        const {partner, classes} = this.props;

59
60
61
62
        if (! partner) {
          return null;
        }

Valeriy Panov's avatar
Valeriy Panov committed
63
        return (
Maxim Babichev's avatar
Maxim Babichev committed
64
            <Card className="m-20" square>
Valeriy Panov's avatar
Valeriy Panov committed
65
66
                <CardHeader
                    classes={ {
Maxim Babichev's avatar
Maxim Babichev committed
67
                        title: `${classes.titleCard}`,
Valeriy Panov's avatar
Valeriy Panov committed
68
69
                        subheader: classes.italic,
                    } }
Matija Obreza's avatar
Matija Obreza committed
70
                    title={ <PartnerLink to={ partner } /> as any }
71
                    subheader={ partner.createdDate && <span>Registered <PrettyDate value={ partner.createdDate } /></span> }
Valeriy Panov's avatar
Valeriy Panov committed
72
73
                />
                <CardContent>
74
                    { partner.description && <Markdown rows={ 3 } source={ partner.description } /> }
Valeriy Panov's avatar
Valeriy Panov committed
75
76
77
                </CardContent>
            </Card>
        );
Matija Obreza's avatar
Matija Obreza committed
78
    }
Valeriy Panov's avatar
Valeriy Panov committed
79
80
81

}

Valeriy Panov's avatar
Valeriy Panov committed
82
export default (withStyles as any)(styles)(PartnerCard);