-
Notifications
You must be signed in to change notification settings - Fork 294
/
LinkWithExternalIcon.jsx
65 lines (56 loc) · 1.24 KB
/
LinkWithExternalIcon.jsx
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
// @flow
import React from "react";
import styled from "styled-components";
import type { ThemedComponent } from "~/renderer/styles/StyleProvider";
import externalLink from "~/renderer/images/external-link.svg";
import Label from "./Label";
const Wrapper: ThemedComponent<{}> = styled(Label).attrs(props => ({
ff: "Inter|SemiBold",
color: props.color,
fontSize: props.fontSize,
alignItems: "center",
}))`
cursor: pointer;
display: inline-flex;
&:hover {
opacity: 0.8;
}
&:active {
opacity: 0.6;
}
&:after {
-webkit-mask: url('${externalLink}');
-webkit-mask-size: cover;
width: 12px;
height: 12px;
vertical-align: baseline;
margin-left: 6px;
content: "";
display: inline-block;
background: currentColor;
}
`;
type Props = {
onClick: ?() => void,
label?: React$Node,
children?: React$Node,
style?: *,
fontSize?: number,
color?: string,
};
// can add more dynamic options if needed
export function LinkWithExternalIcon({
onClick,
label,
children,
style,
fontSize,
color = "wallet",
}: Props) {
return (
<Wrapper onClick={onClick} style={style} fontSize={fontSize || 4} color={color}>
{label || children}
</Wrapper>
);
}
export default LinkWithExternalIcon;