154 lines
3.1 KiB
JavaScript
Raw Normal View History

2019-09-17 15:55:31 +02:00
import styled, { createGlobalStyle } from 'styled-components';
import PropTypes from 'prop-types';
2016-09-30 18:25:04 +02:00
2019-09-17 15:55:31 +02:00
const GlobalNotification = createGlobalStyle`
2016-09-30 18:25:04 +02:00
.notificationIcon {
position: relative;
display: block;
width: 60px;
2019-11-24 23:44:58 +01:00
height: 60px;
> div {
2017-09-09 14:43:11 +02:00
position: absolute;
width: 20px;
height: 20px;
2019-11-24 23:44:58 +01:00
top: 20px; left:20px;
border-radius: 10px;
2019-09-17 15:55:31 +02:00
border: 1px solid ${props => props.theme.main.colors.green};
2019-11-24 23:44:58 +01:00
display: flex;
i, svg {
margin: auto;
font-size: 1.2rem;
color: ${props => props.theme.main.colors.green};
}
2017-09-09 14:43:11 +02:00
}
2016-09-30 18:25:04 +02:00
}
.notificationContent {
display: flex;
align-items: center;
width: 220px;
2016-09-30 18:25:04 +02:00
margin: 0;
padding-right: 10px;
2016-09-30 18:25:04 +02:00
border-right: 1px solid rgba(255, 255, 255, 0.3);
}
.notificationTitle {
2017-09-09 14:43:11 +02:00
margin-bottom: 0;
font-size: 1.4rem;
font-weight: 400;
line-height: 1.8rem;
2016-09-30 18:25:04 +02:00
}
2017-09-09 14:43:11 +02:00
2016-09-30 18:25:04 +02:00
.notificationClose {
cursor: pointer;
opacity: 0.6;
position: relative;
2019-11-24 23:44:58 +01:00
display: flex;
width: 20px;
2018-03-06 09:47:37 +01:00
font-size: 1.4rem;
2018-03-06 14:02:56 +01:00
color: #BBC2BF;
transition: opacity 0.1s ease;
2018-03-06 14:02:56 +01:00
-webkit-font-smoothing: antialiased;
2016-09-30 18:25:04 +02:00
&:hover {
opacity: 1;
}
2019-11-24 23:44:58 +01:00
svg {
margin: auto;
2018-03-06 14:02:56 +01:00
font-size: 1.3rem;
font-weight: 100!important;
2016-09-30 18:25:04 +02:00
}
2017-09-09 14:43:11 +02:00
}
.notificationSuccess{
2019-09-17 15:55:31 +02:00
background: linear-gradient(100deg , #FFFFFF 50%, rgba(39, 183, 15, .05)), ${props =>
props.theme.main.colors.white};
}
2017-09-09 14:43:11 +02:00
.notificationWarning {
2019-09-17 15:55:31 +02:00
background: linear-gradient(100deg , #FFFFFF 50%, rgba(250, 156, 0, .05)), ${props =>
props.theme.main.colors.white};
2017-09-09 14:43:11 +02:00
.notificationIcon:before {
padding-top: 4px;
2019-09-17 15:55:31 +02:00
border-color: ${props => props.theme.main.colors.orange};
color: ${props => props.theme.main.colors.orange};
2017-09-09 14:43:11 +02:00
}
}
.notificationError {
background: linear-gradient(100deg , #FFFFFF 50%, rgba(255, 93, 0, .05)), $white;
2017-09-09 14:43:11 +02:00
.notificationIcon:before {
padding-top: 4px;
2019-09-17 15:55:31 +02:00
border-color: $brand-danger; // red
border-color: ${props => props.theme.main.colors.red};
color: ${props => props.theme.main.colors.red};
2017-09-09 14:43:11 +02:00
}
}
.notificationInfo {
2019-09-17 15:55:31 +02:00
background: linear-gradient(100deg , #FFFFFF 50%, rgba(28, 93, 231, .05)), ${props =>
props.theme.main.colors.white};
2017-09-09 14:43:11 +02:00
.notificationIcon:before {
2019-09-17 15:55:31 +02:00
border-color: ${props => props.theme.main.colors.blue};
color: ${props => props.theme.main.colors.blue};
2017-09-09 14:43:11 +02:00
}
}
2019-09-17 15:55:31 +02:00
`;
const Li = styled.li`
position: relative;
display: flex;
align-items: center;
2019-09-17 15:55:31 +02:00
width: 300px;
min-height: 60px;
margin-bottom: 14px;
background: ${props => props.theme.main.colors.white};
border-radius: 2px;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.15);
color: #333740;
transition: all 0.15s ease;
overflow: hidden;
z-index: 10;
padding: 1rem;
2019-09-17 15:55:31 +02:00
// The last notification must appear from
// the background of the previous one.
&:last-child {
z-index: 1;
}
&:hover {
cursor: pointer;
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.2);
}
`;
Li.defaultProps = {
theme: {
main: {
colors: {
leftMenu: {},
},
sizes: {
header: {},
leftMenu: {},
},
},
},
};
Li.propTypes = {
theme: PropTypes.object,
};
export default Li;
export { GlobalNotification };