-
Notifications
You must be signed in to change notification settings - Fork 11
/
AnimatedLink.styles.js
64 lines (56 loc) · 1.22 KB
/
AnimatedLink.styles.js
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
import styled, { css } from 'react-emotion';
import Icon from 'antd/lib/icon';
import createDynamicTag from '@lskjs/utils/createDynamicTag';
import removeProps from '@lskjs/utils/removeProps';
const dynamicTag = createDynamicTag('a');
const filteredTag = removeProps(dynamicTag, [
'paint',
]);
const paintColors = (p) => {
const { colors } = p.theme;
switch (p.paint) {
case 'primary':
return colors.primary;
default:
return colors.default;
}
};
export const ALink = styled(filteredTag)`
position: relative;
display: inline-block;
font-family: ${p => p.theme.fontFamily};
text-decoration: none;
color: ${paintColors};
&:hover,
&:focus,
&:active {
text-decoration: none;
color: ${paintColors};
}
&:hover {
&:after {
width: 100%;
}
}
&:after {
display: block;
width: 0;
height: 2px;
transition: width .25s;
}
&:before, &:after {
content: '';
position: absolute;
transition: width .25s;
background: ${paintColors};
${p => (p.paint === 'primary' && css`
border-color: ${p.theme.colors.primary};
`)}
}
`;
export const AIcon = styled(Icon)`
position: relative;
top: 1px;
padding-left: 6px;
font-size: 85%;
`;