blob: c196f03ef3c66080aa4a6d4c137d0fa10b2108ab (
plain) (
blame)
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
|
import * as _ from 'lodash';
import * as React from 'react';
import { Container } from 'ts/components/ui/container';
import { Text } from 'ts/components/ui/text';
import { colors } from 'ts/style/colors';
import { utils } from 'ts/utils/utils';
export interface ActionLinkProps {
displayText: string;
linkSrc?: string;
onClick?: () => void;
fontSize?: number;
color?: string;
className?: string;
}
export class ActionLink extends React.Component<ActionLinkProps> {
public static defaultProps = {
fontSize: 16,
color: colors.white,
};
public render(): React.ReactNode {
const { displayText, fontSize, color, className } = this.props;
return (
<Container className={`flex items-center ${className}`} onClick={this._handleClick} cursor="pointer">
<Container>
<Text fontSize="16px" fontColor={color}>
{displayText}
</Text>
</Container>
<Container paddingTop="1px" paddingLeft="6px">
<i className="zmdi zmdi-chevron-right bold" style={{ fontSize, color }} />
</Container>
</Container>
);
}
private readonly _handleClick = (event: React.MouseEvent<HTMLElement>) => {
if (!_.isUndefined(this.props.onClick)) {
this.props.onClick();
} else if (!_.isUndefined(this.props.linkSrc)) {
utils.openUrl(this.props.linkSrc);
}
};
}
|