All files / components/toast toast.template.styled.js

0% Statements 0/21
0% Branches 0/12
0% Functions 0/7
0% Lines 0/15
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 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 87 88 89 90                                                                                                                                                                                   
import styled from 'styled-components'
import PropTypes from 'prop-types'
 
const Colors = {
  success: '#8cc152',
  warning: '#ffc107',
  error: '#f9575b'
}
 
const ToastTemplateStyled = styled.div`
  border: solid 1px #c5d0e1;
  width: 285px;
  height:70px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-flow:${p => p.side === 'left' ? 'row-reverse' : 'row'};
  border-radius: 2px;
  background-color: #ffffff;
 
  ${p => {
    var color = Colors[p.type]
    if (p.side === 'left') {
      return `border-right: solid 4px ${color};`
    } else {
      return `border-left: solid 4px ${color};`
    }
  }}
 
  >.toast-icon-type-container
  {
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
 
    > svg
    {
      width:48px;
      height:48px;
      margin:10px;
    }
  }
 
  .toast-message-container
  {
    width: 100%;
    height:100%;
    display: flex;
    flex-flow: column;
    align-items: ${p => p.side === 'left' ? 'flex-end' : 'flex-start'};
    justify-content: center;
    word-break: break-word;
 
    > h2
    {
      padding:0;
      margin:0;
      font-size: 18px;
      line-height: 1.11;
      text-align:'left';
      font-weight: 400;
      color: ${p => Colors[p.type]};
    }
 
    > p
    {
      padding:0;
      margin:0px;
      font-size: 14px;
      line-height: 1.43;
      text-align: ${p => p.side === 'left' ? 'right' : 'left'};
      color: #3b495e;
    }
  }
  `
 
ToastTemplateStyled.propTypes = {
  type: PropTypes.string,
  side: PropTypes.string
}
 
ToastTemplateStyled.defaultProps = {
  type: 'warning',
  side: 'left'
}
 
export default ToastTemplateStyled