-
Notifications
You must be signed in to change notification settings - Fork 182
/
services-link.tsx
55 lines (47 loc) · 1.19 KB
/
services-link.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
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import Link, {LinkProps} from '../link/link';
import styles from './services.css';
export interface Service {
id: string
applicationName?: string | null | undefined
iconUrl?: string | null | undefined
homeUrl: string
name: string
}
export interface ServicesLinkProps extends Partial<LinkProps> {
service: Service
}
export default class ServicesLink extends PureComponent<ServicesLinkProps> {
static propTypes = {
isActive: PropTypes.bool,
service: PropTypes.shape({
applicationName: PropTypes.string,
iconUrl: PropTypes.string,
homeUrl: PropTypes.string,
name: PropTypes.string
})
};
render() {
const {service, ...props} = this.props;
return (
<Link
target="_self"
href={service.homeUrl}
{...props}
>
{service.iconUrl
? [
<span
key="icon"
className={styles.itemLogo}
style={{backgroundImage: `url(${service.iconUrl})`}}
/>,
<div key="text">{service.name}</div>
]
: service.name
}
</Link>
);
}
}