diff --git a/frontend/src/component/feature/form/__tests__/__snapshots__/form-add-feature-component-test.jsx.snap b/frontend/src/component/feature/form/__tests__/__snapshots__/form-add-feature-component-test.jsx.snap index 32d202f00e..f81dbba592 100644 --- a/frontend/src/component/feature/form/__tests__/__snapshots__/form-add-feature-component-test.jsx.snap +++ b/frontend/src/component/feature/form/__tests__/__snapshots__/form-add-feature-component-test.jsx.snap @@ -49,318 +49,27 @@ ShallowWrapper { "key": undefined, "nodeType": "host", "props": Object { - "children":
- - -
-
- - Enabled - -
-
- -
- -
, - "onSubmit": undefined, - }, - "ref": null, - "rendered": Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "children": Array [ - , - , -
-
- - Enabled - -
-
, - , -
, - , - ], - "style": Object { - "padding": "16px", - }, - }, - "ref": null, - "rendered": Array [ - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "error": Object {}, - "floatingLabel": true, - "label": "Name", - "name": "name", - "onBlur": [Function], - "onChange": [Function], - "required": true, - "value": "feature", - }, - "ref": null, - "rendered": null, - "type": "react-mdl-Textfield", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "floatingLabel": true, - "label": "Description", - "onChange": [Function], - "required": true, - "rows": 1, - "style": Object { - "width": "100%", - }, - "value": "Description", - }, - "ref": null, - "rendered": null, - "type": "react-mdl-Textfield", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "children": Array [ -
, - - Enabled - , -
, - ], - }, - "ref": null, - "rendered": Array [ - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object {}, - "ref": null, - "rendered": null, - "type": "br", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "checked": false, - "children": "Enabled", - "onChange": [Function], - }, - "ref": null, - "rendered": "Enabled", - "type": "react-mdl-Switch", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object {}, - "ref": null, - "rendered": null, - "type": "hr", - }, - ], - "type": "div", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "addStrategy": [MockFunction], - "configuredStrategies": Array [], - "moveStrategy": [MockFunction], - "removeStrategy": [MockFunction], - "updateStrategy": [MockFunction], - }, - "ref": null, - "rendered": null, - "type": "StrategiesSection", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object {}, - "ref": null, - "rendered": null, - "type": "br", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "function", - "props": Object { - "onCancel": [MockFunction], - "submitText": "Create", - }, - "ref": null, - "rendered": null, - "type": [Function], - }, - ], - "type": "section", - }, - "type": "form", - }, - Symbol(enzyme.__nodes__): Array [ - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "children":
- - , +
+
-
-
- - Enabled - -
-
- -
- -
, - "onSubmit": undefined, - }, - "ref": null, - "rendered": Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "children": Array [ + > , + /> , + />


-
, + , -
, + /> +
+
+ , - ], + /> + + , + ], + "className": "fullwidth", + "shadow": 0, + "style": Object { + "overflow": "visible", + }, + }, + "ref": null, + "rendered": Array [ + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": "Create feature toggle", "style": Object { - "padding": "16px", + "paddingTop": "24px", + "wordBreak": "break-all", }, }, "ref": null, + "rendered": "Create feature toggle", + "type": "react-mdl-CardTitle", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": Array [ +
+ + +
+
+ + Enabled + +
+
+ +
+
, + + + , + ], + "onSubmit": undefined, + }, + "ref": null, "rendered": Array [ - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "error": Object {}, - "floatingLabel": true, - "label": "Name", - "name": "name", - "onBlur": [Function], - "onChange": [Function], - "required": true, - "value": "feature", - }, - "ref": null, - "rendered": null, - "type": "react-mdl-Textfield", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "floatingLabel": true, - "label": "Description", - "onChange": [Function], - "required": true, - "rows": 1, - "style": Object { - "width": "100%", - }, - "value": "Description", - }, - "ref": null, - "rendered": null, - "type": "react-mdl-Textfield", - }, Object { "instance": null, "key": undefined, "nodeType": "host", "props": Object { "children": Array [ -
, - - Enabled - , -
, + required={true} + value="feature" + />, + , +
+
+ + Enabled + +
+
, + , +
, ], + "style": Object { + "padding": "16px", + }, }, "ref": null, "rendered": Array [ + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "error": Object {}, + "floatingLabel": true, + "label": "Name", + "name": "name", + "onBlur": [Function], + "onChange": [Function], + "required": true, + "value": "feature", + }, + "ref": null, + "rendered": null, + "type": "react-mdl-Textfield", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "floatingLabel": true, + "label": "Description", + "onChange": [Function], + "required": true, + "rows": 1, + "style": Object { + "width": "100%", + }, + "value": "Description", + }, + "ref": null, + "rendered": null, + "type": "react-mdl-Textfield", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": Array [ +
, + + Enabled + , +
, + ], + }, + "ref": null, + "rendered": Array [ + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object {}, + "ref": null, + "rendered": null, + "type": "br", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "checked": false, + "children": "Enabled", + "onChange": [Function], + }, + "ref": null, + "rendered": "Enabled", + "type": "react-mdl-Switch", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object {}, + "ref": null, + "rendered": null, + "type": "hr", + }, + ], + "type": "div", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "addStrategy": [MockFunction], + "configuredStrategies": Array [], + "moveStrategy": [MockFunction], + "removeStrategy": [MockFunction], + "updateStrategy": [MockFunction], + }, + "ref": null, + "rendered": null, + "type": "StrategiesSection", + }, Object { "instance": null, "key": undefined, @@ -477,71 +376,406 @@ ShallowWrapper { "rendered": null, "type": "br", }, - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "checked": false, - "children": "Enabled", - "onChange": [Function], - }, - "ref": null, - "rendered": "Enabled", - "type": "react-mdl-Switch", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object {}, - "ref": null, - "rendered": null, - "type": "hr", - }, ], - "type": "div", + "type": "section", }, Object { "instance": null, "key": undefined, "nodeType": "host", "props": Object { - "addStrategy": [MockFunction], - "configuredStrategies": Array [], - "moveStrategy": [MockFunction], - "removeStrategy": [MockFunction], - "updateStrategy": [MockFunction], + "children": , }, "ref": null, - "rendered": null, - "type": "StrategiesSection", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object {}, - "ref": null, - "rendered": null, - "type": "br", - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "function", - "props": Object { - "onCancel": [MockFunction], - "submitText": "Create", + "rendered": Object { + "instance": null, + "key": undefined, + "nodeType": "function", + "props": Object { + "onCancel": [MockFunction], + "submitText": "Create", + }, + "ref": null, + "rendered": null, + "type": [Function], }, - "ref": null, - "rendered": null, - "type": [Function], + "type": "react-mdl-CardActions", }, ], - "type": "section", + "type": "form", }, - "type": "form", + ], + "type": "react-mdl-Card", + }, + Symbol(enzyme.__nodes__): Array [ + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": Array [ + + Create feature toggle + , +
+
+ + +
+
+ + Enabled + +
+
+ +
+
+ + + +
, + ], + "className": "fullwidth", + "shadow": 0, + "style": Object { + "overflow": "visible", + }, + }, + "ref": null, + "rendered": Array [ + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": "Create feature toggle", + "style": Object { + "paddingTop": "24px", + "wordBreak": "break-all", + }, + }, + "ref": null, + "rendered": "Create feature toggle", + "type": "react-mdl-CardTitle", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": Array [ +
+ + +
+
+ + Enabled + +
+
+ +
+
, + + + , + ], + "onSubmit": undefined, + }, + "ref": null, + "rendered": Array [ + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": Array [ + , + , +
+
+ + Enabled + +
+
, + , +
, + ], + "style": Object { + "padding": "16px", + }, + }, + "ref": null, + "rendered": Array [ + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "error": Object {}, + "floatingLabel": true, + "label": "Name", + "name": "name", + "onBlur": [Function], + "onChange": [Function], + "required": true, + "value": "feature", + }, + "ref": null, + "rendered": null, + "type": "react-mdl-Textfield", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "floatingLabel": true, + "label": "Description", + "onChange": [Function], + "required": true, + "rows": 1, + "style": Object { + "width": "100%", + }, + "value": "Description", + }, + "ref": null, + "rendered": null, + "type": "react-mdl-Textfield", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": Array [ +
, + + Enabled + , +
, + ], + }, + "ref": null, + "rendered": Array [ + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object {}, + "ref": null, + "rendered": null, + "type": "br", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "checked": false, + "children": "Enabled", + "onChange": [Function], + }, + "ref": null, + "rendered": "Enabled", + "type": "react-mdl-Switch", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object {}, + "ref": null, + "rendered": null, + "type": "hr", + }, + ], + "type": "div", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "addStrategy": [MockFunction], + "configuredStrategies": Array [], + "moveStrategy": [MockFunction], + "removeStrategy": [MockFunction], + "updateStrategy": [MockFunction], + }, + "ref": null, + "rendered": null, + "type": "StrategiesSection", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object {}, + "ref": null, + "rendered": null, + "type": "br", + }, + ], + "type": "section", + }, + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": , + }, + "ref": null, + "rendered": Object { + "instance": null, + "key": undefined, + "nodeType": "function", + "props": Object { + "onCancel": [MockFunction], + "submitText": "Create", + }, + "ref": null, + "rendered": null, + "type": [Function], + }, + "type": "react-mdl-CardActions", + }, + ], + "type": "form", + }, + ], + "type": "react-mdl-Card", }, ], Symbol(enzyme.__options__): Object { diff --git a/frontend/src/component/feature/form/form-add-feature-component.jsx b/frontend/src/component/feature/form/form-add-feature-component.jsx index 03b8bc99e9..f5a9284dbc 100644 --- a/frontend/src/component/feature/form/form-add-feature-component.jsx +++ b/frontend/src/component/feature/form/form-add-feature-component.jsx @@ -1,9 +1,10 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { Textfield, Switch } from 'react-mdl'; +import { Textfield, Switch, Card, CardTitle, CardActions } from 'react-mdl'; import StrategiesSection from './strategies-section-container'; import { FormButtons } from './../../common'; +import { styles as commonStyles } from '../../common'; const trim = value => { if (value && value.trim) { @@ -44,52 +45,57 @@ class AddFeatureComponent extends Component { const configuredStrategies = input.strategies || []; return ( -
-
- validateName(v.target.value)} - onChange={v => setValue('name', trim(v.target.value))} - /> - setValue('description', v.target.value)} - /> -
+ + Create feature toggle + +
+ validateName(v.target.value)} + onChange={v => setValue('name', trim(v.target.value))} + /> + setValue('description', v.target.value)} + /> +
+
+ { + setValue('enabled', !enabled); + }} + > + Enabled + +
+
+ + +
- { - setValue('enabled', !enabled); - }} - > - Enabled - -
-
- - - -
- -
-
+ + + + + + ); } }