diff --git a/src/components/FormInput.jsx b/src/components/FormInput.jsx new file mode 100644 index 0000000..a84853f --- /dev/null +++ b/src/components/FormInput.jsx @@ -0,0 +1,205 @@ +import React from 'react' +import PropTypes from 'prop-types' +import { withStyles } from 'material-ui/styles' +import MenuItem from 'material-ui/Menu/MenuItem' +import TextField from 'material-ui/TextField' +import Button from 'material-ui/Button' + +const styles = theme => ({ + container: { + display: 'flex', + flexWrap: 'wrap', + }, + textField: { + marginLeft: theme.spacing.unit, + marginRight: theme.spacing.unit, + width: 200, + }, + menu: { + width: 200, + }, +}); + +class Form extends React.Component { + +state= { // set initial state to empty strings + firstName: '', + lastName: '', + userName: '', + email: '', + passWord: '', + } + + handleChange = e => { + this.props.onChange({ [e.target.name]: e.target.value }) + this.setState({ + [e.target.name]: e.target.value // change values for input fields and send them to component state + }) + }; + + onSubmit = e => { + e.preventDefault() // prevent reloading on submit + // this.props.onSubmit(this.state) only needed for onSubmit => changed to onChange + this.setState({ // empty state after submit to clear fields + firstName: '', + lastName: '', + userName: '', + email: '', + passWord: '', + }) + } + + render() { + const { classes } = this.props + + return ( +
+
+ this.handleChange(e)}/>
+ this.handleChange(e)}/>
+ this.handleChange(e)}/>
+ this.handleChange(e)}/>
+ this.handleChange(e)}/>

+ + +
+ ); + } +} + +export default withStyles(styles)(Form); + +// ================================================== +// This is the onSubmit version for the form (see additional changes inside secondnest.jsx) +// export default class Form extends React.Component { +// state= { +// firstName: '', +// lastName: '', +// userName: '', +// email: '', +// passWord: '', +// } +// +// change = e => { +// this.setState({ +// [e.target.name]: e.target.value +// }) +// }; +// +// onSubmit = e => { +// e.preventDefault() +// this.props.onSubmit(this.state) +// this.setState({ +// firstName: '', +// lastName: '', +// userName: '', +// email: '', +// passWord: '', +// }) +// } +// +// render() { +// return ( +//
+// this.change(e)}/>
+// this.change(e)}/>
+// this.change(e)}/>
+// this.change(e)}/>
+// this.change(e)}/>
+// +//
+// ); +// } +// } + + +// ############################################################### + +// change function added to cleanUp the code, see below +// +// render() { +// return ( +//
+// this.setState({firstName: e.target.value})}/>
+// this.setState({lastName: e.target.value})}/>
+// this.setState({userName: e.target.value})}/>
+// this.setState({email: e.target.value})}/>
+// this.setState({passWord: e.target.value})}/>
+//
+// ); +// } +// } diff --git a/src/components/IndexButtons.jsx b/src/components/IndexButtons.jsx new file mode 100644 index 0000000..d11cc37 --- /dev/null +++ b/src/components/IndexButtons.jsx @@ -0,0 +1,46 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import Link from 'gatsby-link' + +import { withStyles } from 'material-ui/styles'; +import Button from 'material-ui/Button'; + +const styles = theme => ({ + button: { + margin: theme.spacing.unit + } +}); + +function IndexButtons(props) { + const { classes } = props; + return ( +
+ + + + + + + + + + + + +
+ ); +} + +IndexButtons.propTypes = { + classes: PropTypes.object.isRequired, +}; + +export default withStyles(styles)(IndexButtons); diff --git a/src/components/ResponsiveDrawer.jsx b/src/components/ResponsiveDrawer.jsx index ad2146e..3cca9fb 100644 --- a/src/components/ResponsiveDrawer.jsx +++ b/src/components/ResponsiveDrawer.jsx @@ -22,7 +22,7 @@ import { mailFolderListItems, otherMailFolderListItems } from '../data/tileData' import NestedList from '../data/tileDataClass' import Logo from '../static/instar_250x65.png' -const drawerWidth = 240; +const drawerWidth = 250; const styles = theme => ({ root: { @@ -53,16 +53,7 @@ const styles = theme => ({ [theme.breakpoints.up('md')]: { width: drawerWidth, position: 'relative', - height: '100%', - }, - shadowContainer: { - shadowColor: '#000000', - shadowOffset: { - width: 0, - height: 3 - }, - shadowRadius: 5, - shadowOpacity: 1.0 + bottom: 0, } }, input: { @@ -84,38 +75,33 @@ class ResponsiveDrawer extends React.Component { const drawer = (
- INSTAR Deutschland GmbH + INSTAR Deutschland GmbH {mailFolderListItems} {otherMailFolderListItems}
); - // http://jamesknelson.com/learn-raw-react-ridiculously-simple-forms/ + return (
- + - + INSTAR Wiki - - - - + + + + + diff --git a/src/components/SearchInput.jsx b/src/components/SearchInput.jsx new file mode 100644 index 0000000..7a5a80f --- /dev/null +++ b/src/components/SearchInput.jsx @@ -0,0 +1,59 @@ +import React from 'react' +import PropTypes from 'prop-types' +import { withStyles } from 'material-ui/styles' +import Button from 'material-ui/Button' + +export default class Form extends React.Component { + state= { + firstName: '', + lastName: '', + userName: '', + email: '', + passWord: '', + } + + change = e => { + this.setState({ + [e.target.name]: e.target.value + }) + }; + + onSubmit = e => { + e.preventDefault() + this.props.onSubmit(this.state) + this.setState({ + firstName: '', + lastName: '', + userName: '', + email: '', + passWord: '', + }) + } + +render() { + return ( +
+ this.setState({firstName: e.target.value})}/>
+ this.setState({lastName: e.target.value})}/>
+ this.setState({userName: e.target.value})}/>
+ this.setState({email: e.target.value})}/>
+ this.setState({passWord: e.target.value})}/>
+
+ ); + } +} diff --git a/src/pages/counter.jsx b/src/components/counter.jsx similarity index 100% rename from src/pages/counter.jsx rename to src/components/counter.jsx diff --git a/src/layouts/index.jsx b/src/layouts/index.jsx index b402578..9b84c86 100644 --- a/src/layouts/index.jsx +++ b/src/layouts/index.jsx @@ -18,11 +18,11 @@ const styles = theme => ({ appFrame: { display: 'flex', width: '100%', - height: '100%', }, content: { backgroundColor: theme.palette.background.default, width: '100%', + height: '100%', padding: theme.spacing.unit * 3, height: 'calc(100% - 56px)', marginTop: 56, diff --git a/src/pages/index.jsx b/src/pages/index.jsx index d5b6333..4f3440d 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -1,20 +1,17 @@ import React from 'react' import Link from 'gatsby-link' -import Counter from './counter' +import IndexButtons from './../components/IndexButtons' +import Counter from './../components/Counter' -const IndexPage = ({data}) => ( +const IndexPage = ({data},) => (

{data.site.siteMetadata.description}

Welcome to our new Gatsby site.

Is this the right framework to rebuild our Wiki on? I don't know yet...

-

-

-

-

+



-



- +
) diff --git a/src/pages/nestedroutes/firstnest.jsx b/src/pages/nestedroutes/firstnest.jsx index e1b8fd4..c8f359b 100644 --- a/src/pages/nestedroutes/firstnest.jsx +++ b/src/pages/nestedroutes/firstnest.jsx @@ -1,12 +1,16 @@ import React from 'react' import Link from 'gatsby-link' import Img from 'gatsby-image' + +import { withStyles } from 'material-ui/styles' +import Button from 'material-ui/Button' + import GridList from '../../components/GridList' const firstnest = () => (


- +
) diff --git a/src/pages/nestedroutes/index.jsx b/src/pages/nestedroutes/index.jsx index dc26a7a..8f474ae 100644 --- a/src/pages/nestedroutes/index.jsx +++ b/src/pages/nestedroutes/index.jsx @@ -1,14 +1,19 @@ import React from 'react' import Link from 'gatsby-link' import Img from 'gatsby-image' + +import { withStyles } from 'material-ui/styles' +import Button from 'material-ui/Button' + import FixedTabs from '../../components/FixedTabs' import ScrollableTabs from '../../components/ScrollableTabs' const nestedroutes = ({data}) => (
-

-

-

+

+

+



+

Tabbed Navigation Elements

diff --git a/src/pages/nestedroutes/secondnest.jsx b/src/pages/nestedroutes/secondnest.jsx index 27f5d9d..96b568a 100644 --- a/src/pages/nestedroutes/secondnest.jsx +++ b/src/pages/nestedroutes/secondnest.jsx @@ -1,13 +1,73 @@ import React from 'react' import Link from 'gatsby-link' import Img from 'gatsby-image' + +import { withStyles } from 'material-ui/styles' +import Button from 'material-ui/Button' + import Autocomplete from '../../components/Autocomplete' +import FormInput from '../../components/FormInput' + + +class secondnest extends React.Component { + + state = { + fields: {} // initialize state to receive inputs + } -const secondnest = () => ( -
-

- -
-) + onChange = updatedValue => { + this.setState({ + fields: { + ...this.state.fields, //keep values that are typed + ...updatedValue //add new values while typing + } + }) + } + + render () { + return ( +
+

Autocomplete Input

+

This input field uses react-autosuggest to complete your input compared to a hard-coded list of countries starting with the letter A.

+ + +

Address Form

+

This form adds input to component state. Submit clears the input fields, but keeps values in state - the default browser reload is prevented

+ this.onChange(fields)} /> +

+ {JSON.stringify(this.state.fields, null, 2)} +



+ + +
+ ) + } +} export default secondnest + +// onSubmit Version (above Form renders onChange) => see additional changes in FormInput.JSX +// +// class secondnest extends React.Component { +// +// state = { +// fields: {} +// } +// +// onSubmit = fields => { +// this.setState({fields}) +// } +// +// render () { +// return ( +//
+// this.onSubmit(fields)} /> +//

+// {JSON.stringify(this.state.fields, null, 2)} +//



+//

+// +//
+// ) +// } +// } diff --git a/src/pages/page-1.jsx b/src/pages/page-1.jsx index abf4189..d1890a7 100644 --- a/src/pages/page-1.jsx +++ b/src/pages/page-1.jsx @@ -1,12 +1,15 @@ import React from 'react' import Link from 'gatsby-link' import Img from 'gatsby-image' + +import { withStyles } from 'material-ui/styles' +import Button from 'material-ui/Button' import EnhancedTable from '../components/EnhancedTable' const FirstPage = ({data}) => (


- +
) diff --git a/src/pages/page-2.jsx b/src/pages/page-2.jsx index 8759a23..bced12a 100644 --- a/src/pages/page-2.jsx +++ b/src/pages/page-2.jsx @@ -1,6 +1,9 @@ import React from 'react' import Link from 'gatsby-link' -import Img from "gatsby-image" +import Img from 'gatsby-image' + +import { withStyles } from 'material-ui/styles' +import Button from 'material-ui/Button' const SecondPage = ({data}) => (
@@ -36,7 +39,7 @@ const SecondPage = ({data}) => (

- +
) diff --git a/src/pages/search.jsx b/src/pages/search.jsx index 6c2bd21..a310379 100644 --- a/src/pages/search.jsx +++ b/src/pages/search.jsx @@ -2,6 +2,9 @@ import React, { Component } from 'react'; import Link from 'gatsby-link' import elasticsearch from 'elasticsearch'; +import { withStyles } from 'material-ui/styles' +import Button from 'material-ui/Button' + const connectionString = 'localhost:9200'; const _index = 'wiki2_de_2017_09_09'; const _type = 'article'; @@ -71,8 +74,7 @@ const SearchResults = ({results}) => ( )} -

- +

)