From 61d24fdb2b85b71e205b0110b53f0d7a3a960fe3 Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Sat, 10 Sep 2016 22:58:15 +0200 Subject: [PATCH] Example how to display fields from spec --- src/fields/enum.jsx | 18 ++++++++++++++++++ src/layers/editor.jsx | 8 ++++++-- src/layers/fill.jsx | 3 ++- src/layers/line.jsx | 34 +++++++++++++++++++++++++++++++++- 4 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 src/fields/enum.jsx diff --git a/src/fields/enum.jsx b/src/fields/enum.jsx new file mode 100644 index 0000000..1b6a22b --- /dev/null +++ b/src/fields/enum.jsx @@ -0,0 +1,18 @@ +import React from 'react' +import { Select, Input } from 'rebass' + +export default class EnumField extends React.Component { + static propTypes = { + name: React.PropTypes.string.isRequired, + values: React.PropTypes.array.isRequired, + value: React.PropTypes.string.isRequired, + doc: React.PropTypes.string, + } + + render() { + const options = this.props.values.map(val => { + return {children: val, value: val} + }) + return