930998bea5efd59aa6c339c2a90c3160550a88f2
[aai/sparky-fe.git] / src / generic-components / graph / Link.jsx
1 /*
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23 import React, {Component} from 'react';
24
25 import TempCreateAttributes from './TempCreateAttributes.js';
26
27 class Link extends Component {
28                 
29                 static propTypes = {
30                                 x1: React.PropTypes.number,
31                                 y1: React.PropTypes.number,
32                                 x2: React.PropTypes.number,
33                                 y2: React.PropTypes.number,
34                                 linkAttributes: React.PropTypes.object
35                 };
36                 
37                 static defaultProps = {
38                                 x1: 0,
39                                 y1: 0,
40                                 x2: 0,
41                                 y2: 0,
42                                 linkAttributes: {}
43                 };
44                 
45                 render() {
46                                 let {x1, y1, x2, y2, linkAttributes} = this.props;
47                                 
48                                 let combinedAttributes = {
49                                                 ...linkAttributes,
50                                                 x1: x1,
51                                                 y1: y1,
52                                                 x2: x2,
53                                                 y2: y2
54                                 };
55                                 
56                                 return (
57                                                 <line {...combinedAttributes}
58                                                                 style={TempCreateAttributes.createLineStyle()}/>
59                                 );
60                 }
61 }
62
63 export default Link;