Skip to content
This repository was archived by the owner on Jul 16, 2019. It is now read-only.

Commit c74cc45

Browse files
author
Pedro Scaff
committed
improve css and dummy color picker
1 parent cf4a9fd commit c74cc45

9 files changed

+13136
-5170
lines changed

dist/index.js

+13,055-5,162
Large diffs are not rendered by default.

index.html

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<div id="panes-layout">
99
<div id="session"></div>
1010
<div id="canvas"></div>
11+
<div id="styling"></div>
1112
</div>
1213
<script type="text/javascript" src="./dist/index.js"></script>
1314
</body>

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"license": "ISC",
1212
"dependencies": {
1313
"bootstrap": "^3.3.7",
14+
"prop-types": "^15.5.8",
15+
"rc-color-picker": "^1.1.4",
1416
"react": "^15.4.2",
1517
"react-dom": "^15.4.2"
1618
},

src/CanvasControl.css

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.StylingPane {
2+
display: flex;
3+
flex-direction: column;
4+
padding: 4px;
5+
height: 100%;
6+
}

src/CanvasControl.jsx

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import './css/bootstrap.css';
2+
import './../node_modules/rc-color-picker/assets/index.css';
3+
import './CanvasControl.css';
4+
5+
import {Panel as ColorPickerPanel} from 'rc-color-picker';
6+
7+
import React from 'react';
8+
import PropTypes from 'prop-types';
9+
10+
const PROP_TYPES = {
11+
onStyleChange: PropTypes.func,
12+
canvas: PropTypes.object
13+
};
14+
15+
class CanvasControl extends React.Component {
16+
constructor(props) {
17+
super(props);
18+
// this.onColorChange = this.onColorChange.bind(this);
19+
}
20+
21+
static get propTypes() {
22+
return PROP_TYPES;
23+
}
24+
25+
onColorChange(obj) {
26+
this.props.canvas.updateOptions({colour: obj.color});
27+
}
28+
29+
render() {
30+
return (
31+
<div className='StylingPane'>
32+
<ColorPickerPanel
33+
mode='RGB'
34+
color={'#36c'}
35+
onChange={this.onColorChange.bind(this)}
36+
/>
37+
</div>
38+
);
39+
}
40+
}
41+
42+
export default CanvasControl;

src/ServerConfiguration.css

+14-7
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,28 @@
1414
input {
1515
width: 100%;
1616
background-color: rgba(31, 38, 42, 0.8);
17-
color: white;
17+
color: #c0d3db;
18+
border: 0;
19+
}
20+
21+
input:focus {
22+
outline: none;
23+
}
24+
25+
.Submit {
26+
outline: 1px solid #c0d3db;
1827
}
1928

2029
.AddressField {
2130
flex: 3;
22-
display: flex;
23-
flex-direction: row;
24-
flex-wrap: nowrap;
2531
}
2632

2733
.PortField {
2834
flex: 1;
29-
display: flex;
30-
flex-direction: row;
31-
flex-wrap: nowrap;
35+
}
36+
37+
.PortField > label > input {
38+
text-align: center;
3239
}
3340

3441
.SessionId {

src/ServerConfiguration.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import './css/bootstrap.css';
22
import './ServerConfiguration.css';
33

44
import React from 'react';
5+
import PropTypes from 'prop-types';
56

67
const PROP_TYPES = {
7-
clientCallback: React.PropTypes.func
8+
clientCallback: PropTypes.func
89
};
910

1011
class ServerConfiguration extends React.Component {

src/index.css

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#canvas {
1111
flex: 4;
12+
width: 100%;
1213
}
1314

1415
#session {
@@ -17,3 +18,10 @@
1718
display: flex;
1819
flex-direction: column;
1920
}
21+
22+
#styling {
23+
flex: 1;
24+
background-color: rgba(31, 38, 42, 0.8);
25+
display: flex;
26+
flex-direction: column;
27+
}

src/index.jsx

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import './index.css';
33

44
import drawr from 'drawr';
55
import ServerConfiguration from './ServerConfiguration.jsx';
6+
import CanvasControl from './CanvasControl.jsx';
67

78
import React from 'react';
89
import ReactDOM from 'react-dom';
@@ -49,3 +50,8 @@ ReactDOM.render(
4950
<ServerConfiguration clientCallback={handleConnectionInput}/>,
5051
document.getElementById('session')
5152
);
53+
54+
ReactDOM.render(
55+
<CanvasControl canvas={canvas}/>,
56+
document.getElementById('styling')
57+
);

0 commit comments

Comments
 (0)