-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
styled.elements.tsx
101 lines (90 loc) 路 2.89 KB
/
styled.elements.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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;
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 }) => (
<svg
className={props.className}
version="1.1"
viewBox="0 0 1000 1000"
x="0px"
xmlns="http://www.w3.org/2000/svg"
y="0px"
>
<path d="M968.2,849.4L667.3,549c83.9-136.5,66.7-317.4-51.7-435.6C477.1-25,252.5-25,113.9,113.4c-138.5,138.3-138.5,362.6,0,501C219.2,730.1,413.2,743,547.6,666.5l301.9,301.4c43.6,43.6,76.9,14.9,104.2-12.4C981,928.3,1011.8,893,968.2,849.4z M524.5,522c-88.9,88.7-233,88.7-321.8,0c-88.9-88.7-88.9-232.6,0-321.3c88.9-88.7,233-88.7,321.8,0C613.4,289.4,613.4,433.3,524.5,522z" />
</svg>
)).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;
right: ${props => props.theme.spacing.unit * 4}px;
line-height: 2em;
vertical-align: middle;
margin-right: 2px;
cursor: pointer;
font-style: normal;
color: '#666';
`;