import * as React from 'react'; import { darken, getLuminance, lighten } from 'polished'; import styled from '../../styled-components'; import { MenuItemLabel } from '../SideMenu/styled.elements'; export const SearchWrap = styled.div` padding: 5px 0; `; export const SearchInput = styled.input.attrs(() => ({ className: 'search-input', }))` width: calc(100% - ${props => props.theme.spacing.unit * 8}px); box-sizing: border-box; text-align: right; direction: rtl; margin: 0 ${props => props.theme.spacing.unit * 4}px; padding: 5px ${props => props.theme.spacing.unit * 2}px 5px ${props => props.theme.spacing.unit * 4}px; border: 0; border-bottom: 1px solid ${({ theme }) => (getLuminance(theme.sidebar.backgroundColor) > 0.5 ? darken : lighten)( 0.1, theme.sidebar.backgroundColor, )}; font-family: ${({ theme }) => theme.typography.fontFamily}; font-weight: bold; font-size: 13px; color: ${props => props.theme.sidebar.textColor}; background-color: transparent; outline: none; `; export const SearchIcon = styled((props: { className?: string }) => ( )).attrs({ className: 'search-icon', })` position: absolute; left: ${props => props.theme.spacing.unit * 4}px; height: 1.8em; width: 0.9em; path { fill: ${props => props.theme.sidebar.textColor}; } `; export const SearchResultsBox = styled.div` padding: ${props => props.theme.spacing.unit}px 0; background-color: ${({ theme }) => darken(0.05, theme.sidebar.backgroundColor)}}; color: ${props => props.theme.sidebar.textColor}; min-height: 150px; max-height: 250px; border-top: ${({ theme }) => darken(0.1, theme.sidebar.backgroundColor)}}; border-bottom: ${({ theme }) => darken(0.1, theme.sidebar.backgroundColor)}}; margin-top: 10px; line-height: 1.4; font-size: 0.9em; li { background-color: inherit; } ${MenuItemLabel} { padding-top: 6px; padding-bottom: 6px; &:hover, &.active { background-color: ${({ theme }) => darken(0.1, theme.sidebar.backgroundColor)}; } > svg { display: none; } } `; export const ClearIcon = styled.i` position: absolute; display: inline-block; width: ${props => props.theme.spacing.unit * 2}px; text-align: center; left: ${props => props.theme.spacing.unit * 4}px; line-height: 2em; vertical-align: middle; margin-left: 15px; cursor: pointer; font-style: normal; color: '#666'; `;