-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #368 from codaco/feature/quick-add-namegen
implement quick add property in name gen editor
- Loading branch information
Showing
9 changed files
with
82 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React, { PureComponent } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { compose } from 'recompose'; | ||
import cx from 'classnames'; | ||
import { Field, formValueSelector } from 'redux-form'; | ||
import Guidance from '../../Guidance'; | ||
import { Toggle } from '../../../ui/components/Fields'; | ||
import Form from './Form'; | ||
|
||
class FormWithQuickAdd extends PureComponent { | ||
render() { | ||
const { | ||
quickAdd, | ||
disabled, | ||
} = this.props; | ||
|
||
const formClasses = cx( | ||
'stage-editor-section', | ||
{ 'stage-editor-section--disabled': disabled }, | ||
); | ||
|
||
return ( | ||
<div> | ||
<Guidance contentId="guidance.editor.quickAdd"> | ||
<div className={formClasses}> | ||
<h2 id="issue-form">Quick Add</h2> | ||
<p>Should this stage use the quick add function?</p> | ||
<div className="stage-editor-section-form"> | ||
<Field | ||
name="quickAdd" | ||
component={Toggle} | ||
label="Enable the quick add function" | ||
/> | ||
</div> | ||
</div> | ||
</Guidance> | ||
{ !quickAdd && <Form {...this.props} /> } | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = (state, { form }) => { | ||
const selector = formValueSelector(form.name); | ||
const quickAdd = selector(state, 'quickAdd'); | ||
const nodeType = selector(state, 'subject.type'); | ||
|
||
return { | ||
quickAdd, | ||
disabled: !nodeType, | ||
}; | ||
}; | ||
|
||
export { FormWithQuickAdd }; | ||
|
||
export default compose( | ||
connect(mapStateToProps), | ||
)(FormWithQuickAdd); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule network-canvas
updated
from 1aee49 to 9faf28
Submodule ui
updated
from 42cef8 to c94c23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Temporary workaround until unsafe-eval issue is resolved | ||
module.exports = () => {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters