@hbsis.uikit/react
Version:
Biblioteca ReactJS
90 lines (78 loc) • 1.77 kB
JavaScript
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