Skip to content

Commit

Permalink
Merge pull request #10 from kadirahq/style-improvements
Browse files Browse the repository at this point in the history
Style improvements
  • Loading branch information
roonyh committed Aug 30, 2016
2 parents eb45329 + 0f160ee commit bf31747
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
17 changes: 12 additions & 5 deletions src/components/Panel.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import PropForm from './PropForm';
import tosource from 'tosource';
import { js_beautify as beautify } from 'js-beautify';
import { js_beautify as beautify } from 'js-beautify'; // eslint-disable-line camelcase

const styles = {
panel: {
padding: '5px',
width: '100%',
position: 'relative',
},
noKnobs: {
fontFamily: `
Expand All @@ -20,10 +21,16 @@ const styles = {
padding: '10px',
},
resetButton: {
color: 'rgb(130, 130, 130)',
float: 'right',
marginRight: '5px',
marginTop: '5px',
position: 'absolute',
bottom: 0, right: 0,
border: 'none',
borderTop: 'solid 1px rgba(0, 0, 0, 0.2)',
borderLeft: 'solid 1px rgba(0, 0, 0, 0.2)',
background: 'rgba(255, 255, 255, 0.5)',
padding: '5px 10px',
borderRadius: '4px 0 0 0',
color: 'rgba(0, 0, 0, 0.5)',
outline: 'none',
},
};

Expand Down
17 changes: 12 additions & 5 deletions src/components/PropField.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import AceEditor from 'react-ace';
import brace from 'brace';

import 'brace/mode/javascript';
import 'brace/theme/github';
Expand Down Expand Up @@ -44,6 +43,11 @@ stylesheet.checkbox = {
width: 'auto',
};

stylesheet.objectInputLabel = {
...stylesheet.label,
verticalAlign: 'top',
};

export default class PropField extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -82,7 +86,7 @@ export default class PropField extends React.Component {

if (type === 'object') {
inputElem = (
<div style={{border: '1px solid rgb(236, 236, 236)', padding: '5px'}}>
<div style={{ border: '1px solid rgb(236, 236, 236)', padding: '5px' }}>
<AceEditor
mode="javascript"
theme="github"
Expand All @@ -91,8 +95,8 @@ export default class PropField extends React.Component {
name={this.props.name}
width="100%"
height="120px"
editorProps={{$blockScrolling: true}}
setOptions={{showLineNumbers: false}}
editorProps={{ $blockScrolling: true }}
setOptions={{ showLineNumbers: false }}
showPrintMargin={false}
showGutter={false}
highlightActiveLine={false}
Expand Down Expand Up @@ -126,9 +130,12 @@ export default class PropField extends React.Component {
);
}

const labelStyles =
type === 'object' ? stylesheet.objectInputLabel : stylesheet.label;

return (
<div style={stylesheet.field}>
<label htmlFor={this.props.name} style={stylesheet.label}>
<label htmlFor={this.props.name} style={labelStyles}>
{`${this.props.name}`}
</label>
{ inputElem }
Expand Down
1 change: 0 additions & 1 deletion src/components/PropForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const stylesheet = {
boxSizing: 'border-box',
width: '100%',
maxWidth: '500px',
margin: '0 auto',
borderCollapse: 'separate',
borderSpacing: '5px',
},
Expand Down

0 comments on commit bf31747

Please sign in to comment.