Skip to content

Instantly share code, notes, and snippets.

@gcmatheusj
Created August 30, 2019 14:37
Show Gist options
  • Select an option

  • Save gcmatheusj/8ddd0d68a79708fdcfff1578e55b2a95 to your computer and use it in GitHub Desktop.

Select an option

Save gcmatheusj/8ddd0d68a79708fdcfff1578e55b2a95 to your computer and use it in GitHub Desktop.
import styled, { css } from 'styled-components';
import PerfectScrollBar from 'react-perfect-scrollbar';
import { lighten } from 'polished';
export const Container = styled.div`
position: relative;
`;
export const Badge = styled.button`
background: none;
border: 0;
position: relative;
${props =>
props.hasUnread &&
css`
&::after {
position: absolute;
right: 0;
top: 0;
width: 8px;
height: 8px;
background: #ff892e;
content: '';
border-radius: 50%;
}
`}
`;
export const NotificationList = styled.div`
position: absolute;
width: 260px;
left: calc(50% - 130px);
top: calc(100% + 25px);
background: rgba(0, 0, 0, 0.6);
border-radius: 4px;
padding: 15px 5px;
display: ${props => (props.visible ? 'block' : 'none')};
&::before {
content: '';
position: absolute;
left: calc(50% - 10px);
top: -10px;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid rgba(0, 0, 0, 0.6);
}
`;
export const Scroll = styled(PerfectScrollBar)`
max-height: 260px;
padding: 5px 15px;
`;
export const Notification = styled.div`
color: #fff;
& + div {
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
p {
font-size: 13px;
line-height: 18px;
}
time {
display: block;
font-size: 12px;
opacity: 0.6;
margin-bottom: 5px;
}
button {
font-size: 12px;
border: 0;
background: none;
color: ${lighten(0.2, '#00cac9')};
}
${props =>
props.unread &&
css`
&::after {
display: inline-block;
margin-left: 5px;
width: 8px;
height: 8px;
background: #ff892e;
content: '';
border-radius: 50%;
margin-left: 10px;
}
`}
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment