ArticleSection.tsx 3.87 KB
Newer Older
Matija Obreza's avatar
Matija Obreza committed
1
import * as React from 'react';
Oleksii Savran's avatar
Oleksii Savran committed
2
import { translate } from 'react-i18next';
Matija Obreza's avatar
Matija Obreza committed
3 4

import Grid from '@material-ui/core/Grid';
Oleksii Savran's avatar
Oleksii Savran committed
5 6
import withStyles from '@material-ui/core/styles/withStyles';
import { ExternalLink } from 'ui/common/Links';
Matija Obreza's avatar
Matija Obreza committed
7

Oleksii Savran's avatar
Oleksii Savran committed
8
const styles = (theme) => ({
Matija Obreza's avatar
Matija Obreza committed
9 10
  /*tslint:disable*/
  root: {
Oleksii Savran's avatar
Oleksii Savran committed
11 12 13
    height: 'calc(100% - 51px)',
  },
  wrapper: {
Matija Obreza's avatar
Matija Obreza committed
14 15
    backgroundColor: 'white',
    padding: '33px 40px 49px 40px',
Oleksii Savran's avatar
Oleksii Savran committed
16 17 18 19
    height: '100%',
    boxSizing: 'border-box' as 'border-box',
  },
  text: {
Matija Obreza's avatar
Matija Obreza committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    '& > p': {
      fontFamily: 'Roboto-Light',
      fontSize: '24px',
      color: '#4d4c46',
      lineHeight: '36px',
      margin: 0,
    },
    '& > h3': {
      fontSize: '24px',
      marginTop: '28px',
      paddingBottom: '6px',
    },
    '& > ul': {
      marginTop: '30px',
      padding: 0,
      paddingLeft: '11px',
    },
    '& > ul > li': {
      fontFamily: 'Roboto-Regular',
      fontSize: '18px',
      lineHeight: '30px',
    },
  },
Oleksii Savran's avatar
Oleksii Savran committed
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
  social: {
    borderTop: '1px solid #d5d4d3',
    borderBottom: '1px solid #d5d4d3',
    marginTop: '57px',
    paddingTop: '20px',
    paddingBottom: '19px',
    fontSize: '1.3rem',
  },
  socialLink: {
    backgroundColor: 'white', //
    display: 'inline-block',
    paddingLeft: '18px',
    [theme.breakpoints.down('xs')]: {
      paddingLeft: '0',
      width: '50%',
      textAlign: 'center' as 'center',
    },
    '&:hover > a > *': {
      filter: 'brightness(0.5)',
      transition: 'all, 0.1s',
    }
  },
  socialText: {
    [theme.breakpoints.down('sm')]: {
      display: 'none',
    },
  },
Matija Obreza's avatar
Matija Obreza committed
70
  /*tslint:enable*/
Oleksii Savran's avatar
Oleksii Savran committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
  share: {
    fontSize: '1.3rem',
    display: 'inline-block',
    color: '#4d4c46',
    [theme.breakpoints.down('xs')]: {
      width: '100%',
      textAlign: 'center' as 'center',
      marginBottom: '20px',
    },
  },
  twitter: {
    color: '#1da1f2',
    verticalAlign: 'middle',
  },
  linkedin: {
    color: '#0077b5',
    verticalAlign: 'middle',
  },
  icon: {
    fontSize: '3.6rem',
    marginRight: '10px',
    [theme.breakpoints.down('xs')]: {
      marginRight: '0',
    },
  },
Matija Obreza's avatar
Matija Obreza committed
96 97 98 99
});

interface IArticleSectionProps extends React.ClassAttributes<any> {
  classes: any;
Oleksii Savran's avatar
Oleksii Savran committed
100
  className?: string;
Oleksii Savran's avatar
Oleksii Savran committed
101 102 103
  title?: string;
  t: any;
  body: string;
Matija Obreza's avatar
Matija Obreza committed
104 105 106 107 108
}

class ArticleSection extends React.Component<IArticleSectionProps> {

  public render() {
Oleksii Savran's avatar
Oleksii Savran committed
109
    const {classes, className, title, t, body} = this.props;
Matija Obreza's avatar
Matija Obreza committed
110
    return(
Oleksii Savran's avatar
Oleksii Savran committed
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
      <Grid item xs={ 9 } className={ `${className} ${classes.root}` }>
        <div className={ classes.wrapper }>
          <div className={ classes.text } dangerouslySetInnerHTML={ {__html: body} }/>
          { title && (
            <div className={ classes.social }>
              <div className={ classes.share }>
                { t('cms.public.c.activityPostSection.shareArticle') }
              </div>
              <div className={ classes.socialLink }>
                <ExternalLink link={ `https://twitter.com/intent/tweet?url=${window.location}&GenesysPGR` }>
                  <i className={ `fa fa-twitter-square ${classes.twitter} ${classes.icon}` }/>
                  <span className={ `${classes.twitter} ${classes.socialText}` }>
                { t('cms.public.c.activityPostSection.tweet') }
              </span>
                </ExternalLink>
              </div>
              <div className={ classes.socialLink }>
                <ExternalLink link={ `https://www.linkedin.com/shareArticle?mini=true&url=${window.location}&title=${title}&summary=${body}&source=GenesysPGR` }>
                  <i className={ `fa fa-linkedin-square ${classes.linkedin} ${classes.icon}` }/>
                  <span className={ `${classes.linkedin} ${classes.socialText}` }>
                { t('cms.public.c.activityPostSection.shareLinkedin') }
              </span>
                </ExternalLink>
              </div>
            </div>
          ) }
        </div>
Matija Obreza's avatar
Matija Obreza committed
138 139 140 141 142 143
      </Grid>
    );
  }

}

Oleksii Savran's avatar
Oleksii Savran committed
144
export default translate()(withStyles(styles)(ArticleSection));