Skip to content

Instantly share code, notes, and snippets.

@olecksamdr
Created April 17, 2019 14:01
Show Gist options
  • Save olecksamdr/5dc13ac4a166caa699cb834d88bbc91c to your computer and use it in GitHub Desktop.
Save olecksamdr/5dc13ac4a166caa699cb834d88bbc91c to your computer and use it in GitHub Desktop.
import styled from 'styled-components';
import { SORT_ORDERS } from './constants';
const { ASC, DESC } = SORT_ORDERS;
const SortIcon = styled.span`
margin-left: 0.5em;
height: 1em;
vertical-align: middle;
display: inline-flex;
flex-direction: column;
justify-content: center;
&::before,
&::after {
width: 0;
height: 0;
content: '';
display: block;
border-left: 0.35em solid transparent;
border-right: 0.35em solid transparent;
}
&::before {
margin-bottom: 0.25em;
border-bottom: 0.35em solid #818c97;
${({ sortOrder }) => sortOrder === DESC && 'border-bottom-color: #e93f43'}
}
&::after {
border-top: 0.35em solid #818c97;
${({ sortOrder }) => sortOrder === ASC && 'border-top-color: #e93f43'}
}
`;
export default SortIcon;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment