PartnerCard.tsx 2.1 KB
Newer Older
1 2 3 4 5 6 7
import * as React from 'react';
import { translate } from 'react-i18next';
import { withStyles } from '@material-ui/core/styles';
import Card, { CardHeader, CardContent } from 'ui/common/Card';
import { PartnerLink } from 'ui/catalog/Links';

import Partner from 'model/genesys/Partner';
Matija Obreza's avatar
Matija Obreza committed
8
import Markdown from 'ui/common/markdown';
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
import PrettyDate from 'ui/common/time/PrettyDate';

// import { Properties, PropertiesItem } from 'ui/catalog/Properties';

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

const styles = (theme) => ({
  /* tslint:disable */
  leftBorder: {
    borderLeft: 'solid 1px #eee',
    padding: '10px 5px 20px 20px',
    '& > h1': {
      fontSize: '30px',
      marginTop: '3px',
      color: '#006CB4',
    },
    [theme.breakpoints.down('sm')]: {
      padding: '7px 5px 7px 10px',
    },
  },
  /* tslint:enable */
  italic: {
    fontSize: '1rem',
    fontStyle: 'italic',
    color: '#4d4c46',
  },
  margin: {
    marginLeft: '2px',
  },
  grayBackgroundWrapper: {
    flexWrap: 'nowrap',
    marginBottom: '20px',
    [theme.breakpoints.down('sm')]: {
      flexWrap: 'wrap',
    },
  },
  titleCard: {
    marginBottom: '20px',
    [theme.breakpoints.down('sm')]: {
      fontSize: '20px',
      lineHeight: '25px',
    },
  },
});

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

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

    if (!partner) {
      return null;
    }

    return (
      <Card className="mb-20" square>
        <CardHeader
          classes={ {
            title: `${classes.titleCard}`,
            subheader: classes.italic,
          } }
          title={ <PartnerLink to={ partner }/> as any }
          subheader={ partner.createdDate && <span>{ t('common:label.registered') } <PrettyDate value={ partner.createdDate }/></span> }
        />
        <CardContent>
          { partner.description && <Markdown firstParagraph source={ partner.description }/> }
        </CardContent>
      </Card>
    );
  }

}

export default translate()((withStyles as any)(styles)(PartnerCard));