Created
April 17, 2019 14:01
-
-
Save olecksamdr/5dc13ac4a166caa699cb834d88bbc91c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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