All files / nav-sidebar/components NewsLink.jsx

80% Statements 4/5
100% Branches 0/0
50% Functions 1/2
80% Lines 4/5
1 2 3 4 5 6 7 8 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          1x                       1x                             2x                         1x          
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { Text, ClickIcon } from '@bufferapp/components';
 
const Container = styled.span`
  cursor: pointer;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0.5rem 1rem;
 
  svg {
    margin: 0 0.5rem 0 0;
  }
`;
 
const Beamer = styled.span`
  display: inline-block;
  padding: 0 1.5rem 0 0;
 
  .beamer_icon {
    background-color: #178eea !important;
  }
`;
 
class NewsLink extends Component {
  handleClick = () => {
    document.getElementById('beamer').click();
  }
 
  render() {
    return (
      <Container onClick={this.handleClick}>
        <ClickIcon />
        <Beamer id="beamer">
          <Text size="small" color="shuttleGray">
            {this.props.children}
          </Text>
        </Beamer>
      </Container>
    );
  }
}
 
NewsLink.propTypes = {
  children: PropTypes.node.isRequired,
};
 
export default NewsLink;