diff --git a/client/src/components/UserSearch.js b/client/src/components/UserSearch.js index 9335c5145..3c193dd20 100644 --- a/client/src/components/UserSearch.js +++ b/client/src/components/UserSearch.js @@ -14,17 +14,7 @@ import Button from '@material-ui/core/Button'; import Typography from '@material-ui/core/Typography'; import Grid from '@material-ui/core/Grid'; import Paper from '@material-ui/core/Paper'; - -// Full screen dialog imports (still Material UI) - -import PropTypes from 'prop-types'; -import Dialog from '@material-ui/core/Dialog'; -import AppBar from '@material-ui/core/AppBar'; -import Toolbar from '@material-ui/core/Toolbar'; -import IconButton from '@material-ui/core/IconButton'; - -import CloseIcon from '@material-ui/icons/Close'; -import Slide from '@material-ui/core/Slide'; +import TextField from '@material-ui/core/TextField' // components import UserProfile from './UserProfile'; @@ -39,8 +29,8 @@ const styles = theme => ({ margin: 2, }, card: { - maxWidth: 345, - minWidth: 300, + maxWidth: 145, + minWidth: 100, paddingTop:'30' }, media: { @@ -62,14 +52,15 @@ const styles = theme => ({ }, grid: { paddingTop: '30', - marginTop:'30' + marginTop:30 + }, + inputField: { + width: '80%', + marginLeft: '10%', + marginTop: 25 }, }); -function Transition(props) { - return ; -} - class UserSearch extends Component { constructor(props){ @@ -88,6 +79,50 @@ class UserSearch extends Component { this.setState({ open: false }); }; + submitForm (e) { + e.preventDefault() + } + + handleTextField (e) { + /* + We will do some basic input validations here. If something is wrong we will turn on the error sign on the textfield. + */ + + let value = e.target.value + + switch (e.target.id) { + case 'alias': + if (value.length > 30) { + this.setState({aliasError: true}) + } else { + this.setState({aliasError: false, alias: value}) + } + break + case 'firstName': + if (value.length > 30) { + this.setState({firstNameError: true}) + } else { + this.setState({firstNameError: false, firstName: value}) + } + break + case 'middleName': + if (value.length > 30) { + this.setState({middleNameError: true}) + } else { + this.setState({middleNameError: false, middleName: value}) + } + break + case 'lastName': + if (value.length > 50) { + this.setState({lastNameError: true}) + } else { + this.setState({lastNameError: false, lastName: value}) + } + break + default: + } + } + displayUsers(){ let data = this.props.getUsersQuery; const { classes } = this.props; @@ -98,7 +133,7 @@ class UserSearch extends Component { return data.users.map(user => { return ( - + { this.setState({ selected: user.id}); @@ -115,46 +150,20 @@ class UserSearch extends Component { {user.alias} - - {user.bio} - - - - - - - - - - User Profile - - - - - - - - - + ) }); } @@ -164,18 +173,58 @@ class UserSearch extends Component { const { classes } = this.props; return ( - +
+ + + + + + + + + + {this.displayUsers()} - + + +
); } } -UserSearch.propTypes = { - classes: PropTypes.object.isRequired, -}; - export default compose( graphql(getUsersQuery, {name: "getUsersQuery"}), withStyles(styles)