From e05904f2e992ce3184952a8e569d9c28d85d68de Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 21 May 2018 02:49:46 +0200 Subject: basic css for form elements --- app/client/common/header.component.js | 18 ++++++++++++++ app/client/common/paramGroup.component.js | 23 ++++++++++++++++++ app/client/common/slider.component.js | 40 +++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 app/client/common/header.component.js create mode 100644 app/client/common/paramGroup.component.js create mode 100644 app/client/common/slider.component.js (limited to 'app/client/common') diff --git a/app/client/common/header.component.js b/app/client/common/header.component.js new file mode 100644 index 0000000..bb2ec04 --- /dev/null +++ b/app/client/common/header.component.js @@ -0,0 +1,18 @@ +import { h, Component } from 'preact' +import { connect } from 'react-redux' + +function Header(props) { + return ( +
+ live cortex +
+ ) +} + +const mapStateToProps = state => ({ +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ +}) + +export default connect(mapStateToProps, mapDispatchToProps)(Header) diff --git a/app/client/common/paramGroup.component.js b/app/client/common/paramGroup.component.js new file mode 100644 index 0000000..276425b --- /dev/null +++ b/app/client/common/paramGroup.component.js @@ -0,0 +1,23 @@ +import { h, Component } from 'preact' +import { connect } from 'react-redux' + +function ParamGroup(props) { + return ( +
+ + {props.children} +
+ ) +} + +const mapStateToProps = state => ({ + +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ +}) + +export default connect(mapStateToProps, mapDispatchToProps)(ParamGroup) diff --git a/app/client/common/slider.component.js b/app/client/common/slider.component.js new file mode 100644 index 0000000..8932fbd --- /dev/null +++ b/app/client/common/slider.component.js @@ -0,0 +1,40 @@ +import { h, Component } from 'preact' +import { connect } from 'react-redux' + +class Slider extends Component { + render(){ + const props = this.props + const name = props.name + const title = props.title || name.replace(/_/g, ' ') + let step; + if (props.type === 'int') { + step = 1 + } else { + step = (props.max - props.min) / 100 + } + return ( +
+ + +
+ ) + } +} + +const mapStateToProps = state => ({ +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + ...ownProps, +}) + +export default connect(mapStateToProps, mapDispatchToProps)(Slider) -- cgit v1.2.3-70-g09d2