working on custom dropdown and pulling in platform members as datas

This commit is contained in:
Alex Windett 2017-01-30 15:20:37 +00:00
parent 59b678a101
commit 023f7fbe04
3 changed files with 95 additions and 89 deletions

View File

@ -43,6 +43,7 @@
"react-redux": "^5.0.2", "react-redux": "^5.0.2",
"react-router": "4.0.0-alpha.6", "react-router": "4.0.0-alpha.6",
"reduce-reducers": "^0.1.2", "reduce-reducers": "^0.1.2",
"react-select": "^1.0.0-rc.2",
"redux": "^3.6.0", "redux": "^3.6.0",
"redux-actions": "^1.2.0", "redux-actions": "^1.2.0",
"redux-batched-actions": "^0.1.5", "redux-batched-actions": "^0.1.5",

View File

@ -1,107 +1,109 @@
const React = require('react'); const React = require('react');
// const PropTypes = require('@root/prop-types');
const Row = require('@ui/components/row'); const Row = require('@ui/components/row');
const Column = require('@ui/components/column'); const Column = require('@ui/components/column');
const Button = require('@ui/components/button'); const Button = require('@ui/components/button');
// const SelectCustom = require('@ui/components/select-custom');
const Invite = (props) => { // TOOD: Require from UI Components - causes issue ATM.
const Select = require('react-select');
require('react-select/dist/react-select.css');
const { const Invite = React.createClass({
// people = [],
handleToggle,
// platformMembers
} = props;
// const InputStyle = { propTypes: {
// float: 'left', // UI: React.PropTypes.object,
// width: '75%' handleToggle: React.PropTypes.func,
// }; // people: React.PropTypes.array,
platformMembers: React.PropTypes.array,
},
const AddButtonStyle = { getInitialState() {
float: 'right', return {
width: '20%' selectValue: '',
}; members: []
};
},
const styleInline = { getFormattedPlatformMembers() {
display: 'inline-block' return this.props.platformMembers.map((m) => ({
}; value: m.email,
label: m.name
}));
},
// const selectData = [ render() {
// {
// value: 'one',
// label: 'One'
// },
// {
// value: 'two',
// label: 'Two'
// },
// {
// value: 'three',
// label: 'Three'
// },
// {
// value: 'four',
// label: 'Four'
// },
// {
// value: 'five',
// label: 'Five'
// },
// {
// value: 'six',
// label: 'Six'
// }
// ];
return ( const {
<Row> handleToggle,
<Column xs={6}> // UI = {},
<p>Search for a person by name or email or enter an email address // people = [],
to invite someone new.</p> } = this.props;
<Row> const InputStyle = {
<Column xs={12}> float: 'left',
{/*TODO: Fix why there are issues with webpack and nodemodules*/} width: '75%'
{/*<SelectCustom*/} };
{/*multi*/}
{/*onChange={function noop() {}}*/}
{/*options={selectData}*/}
{/*placeholder="Enter an email address or password"*/}
{/*style={InputStyle}*/}
{/*/>*/}
<Button
secondary
style={AddButtonStyle}
>
Add
</Button>
</Column>
</Row>
<Button const AddButtonStyle = {
onClick={handleToggle} float: 'right',
secondary width: '20%'
style={styleInline} };
>
Cancel
</Button>
<Button const styleInline = {
style={styleInline} display: 'inline-block'
> };
Send Invitation(s)
</Button>
</Column>
</Row>
);
};
Invite.propTypes = { const selectData = this.getFormattedPlatformMembers();
handleToggle: React.PropTypes.func,
// orgUI: React.PropTypes.obj, const handleSelectChange = (v) => {
// people: React.PropTypes.arrayOf(PropTypes.person) this.setState({
}; selectValue: v
});
};
return (
<Row>
<Column xs={6}>
<p>Search for a person by name or email or enter an email address
to invite someone new.</p>
<Row>
<Column xs={12}>
{/*TODO: Fix why there are issues with webpack and nodemodules*/}
<Select
onChange={handleSelectChange}
options={selectData}
placeholder="Enter an email address or password"
style={InputStyle}
value={this.state.selectValue}
/>
<Button
secondary
style={AddButtonStyle}
>
Add
</Button>
</Column>
</Row>
<Button
onClick={handleToggle}
secondary
style={styleInline}
>
Cancel
</Button>
<Button
style={styleInline}
>
Send Invitation(s)
</Button>
</Column>
</Row>
);
},
});
module.exports = Invite; module.exports = Invite;

View File

@ -535,6 +535,9 @@
}, },
"projects": { "projects": {
"ui": { "ui": {
"invite_toggled": true,
"member_status_tooltip": false,
"member_role_tooltip": false,
"sections": [ "sections": [
"services", "services",
"instances", "instances",