-
Notifications
You must be signed in to change notification settings - Fork 295
/
ButtonLink.tsx
47 lines (41 loc) · 1.27 KB
/
ButtonLink.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
// @flow
import React, { Component } from 'react';
import { get } from 'lodash';
import classNames from 'classnames';
import { Button } from 'react-polymorph/lib/components/Button';
import { Link } from 'react-polymorph/lib/components/Link';
import { LinkSkin } from 'react-polymorph/lib/skins/simple/LinkSkin';
import styles from './ButtonLink.scss';
type LinkPropsTypes = {
isUnderlined?: boolean,
underlineOnHover?: boolean,
hasIconBefore?: boolean,
hasIconAfter?: boolean,
className?: string,
};
type Props = {
linkProps?: LinkPropsTypes,
label: string,
};
export default class ButtonLink extends Component<Props> {
render() {
const { label, linkProps } = this.props;
const linkLabelClasses = classNames([
styles.linkLabel,
get(linkProps, 'className', null),
]);
const linkLabel = (
<Link
label={label}
isUnderlined={get(linkProps, 'isUnderlined', false)}
underlineOnHover={get(linkProps, 'underlineOnHover', false)}
hasIconBefore={get(linkProps, 'hasIconBefore', true)}
hasIconAfter={get(linkProps, 'hasIconAfter', false)}
className={linkLabelClasses}
skin={LinkSkin}
themeOverrides={styles}
/>
);
return <Button {...this.props} label={linkLabel} />;
}
}