-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into master
- Loading branch information
Showing
67 changed files
with
2,216 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"presets": ["env", "react"], | ||
"plugins": ["react-hot-loader/babel"] | ||
"presets": ["env", "react", "stage-2"], | ||
"plugins": [ | ||
"react-hot-loader/babel", | ||
["transform-class-properties", { "spec": true }] | ||
] | ||
} |
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
MESSAGE="hello world loaded from the .env.example file" | ||
THEME="light" | ||
CLOCK_DISPLAY="12" | ||
LISTEN_SEND_KEYS="off" | ||
LOCALE="en" |
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
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,44 @@ | ||
import React, { Component } from 'react'; | ||
|
||
// using HashRouter that will make the routes work | ||
// over a deployment that hasn't a backend with historyApiFallback support | ||
import { HashRouter } from 'react-router-dom'; | ||
|
||
import { NavBar } from './containers'; | ||
import { Layout, LayoutHeader, LayoutBody } from './components/layout'; | ||
|
||
import Routes from './Routes'; | ||
|
||
class Chat extends Component { | ||
|
||
render() { | ||
|
||
/* | ||
<HashRouter> | ||
<Layout> | ||
<LayoutHeader> | ||
<NavBar /> | ||
</LayoutHeader> | ||
<LayoutBody> | ||
<Routes /> | ||
</LayoutBody> | ||
</Layout> | ||
</HashRouter> | ||
*/ | ||
|
||
return ( | ||
<HashRouter> | ||
<Layout> | ||
<LayoutHeader> | ||
<NavBar /> | ||
</LayoutHeader> | ||
<LayoutBody> | ||
<Routes /> | ||
</LayoutBody> | ||
</Layout> | ||
</HashRouter> | ||
); | ||
} | ||
} | ||
|
||
export default Chat; |
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,12 @@ | ||
import React, { Fragment } from 'react'; | ||
import { Route, Switch } from 'react-router-dom'; | ||
import { ChatRoom, Settings } from './containers'; | ||
|
||
const Routes = () => ( | ||
<Switch> | ||
<Route exact path="/" component={ChatRoom} /> | ||
<Route path="/settings" component={Settings} /> | ||
</Switch> | ||
); | ||
|
||
export default Routes; |
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 @@ | ||
@import 'components/styles'; | ||
@import 'containers/styles'; |
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
@import 'layout/styles'; | ||
@import 'form/styles'; | ||
@import 'message/styles'; |
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,52 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
/* | ||
usage: | ||
<FormGroup | ||
theme={ theme } | ||
label="labelToTheField" | ||
> | ||
< InputField, InputRadioGroup /> | ||
</FormGroup> | ||
*/ | ||
class FormGroup extends Component { | ||
|
||
// https://reactjs.org/docs/typechecking-with-proptypes.html | ||
static propTypes = { | ||
theme: PropTypes.string.isRequired, | ||
label: PropTypes.string.isRequired, | ||
children: PropTypes.element.isRequired | ||
} | ||
|
||
// https://reactjs.org/docs/react-without-es6.html#declaring-default-props | ||
static defaultProps = { | ||
theme: 'light' | ||
} | ||
|
||
// https://jaketrent.com/post/send-props-to-children-react/ | ||
// https://reactjs.org/docs/react-api.html#reactchildren | ||
renderChildren = ( theme, children ) => { | ||
return React.Children.map( children, child => { | ||
return React.cloneElement( child, { | ||
theme | ||
}); | ||
}); | ||
} | ||
|
||
render() { | ||
const { theme, label, children } = this.props; | ||
|
||
return ( | ||
<div className="form-group"> | ||
<div>{ label }</div> | ||
{ this.renderChildren( theme, children ) } | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default FormGroup; |
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,50 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
/* | ||
usage: | ||
<InputField | ||
theme={ theme } | ||
type={ 'text' | 'password' } | ||
name="sameAttributeNameFromState" | ||
onChange={ this.handleChange } | ||
/> | ||
*/ | ||
class InputText extends Component { | ||
|
||
// https://reactjs.org/docs/typechecking-with-proptypes.html | ||
static propTypes = { | ||
theme: PropTypes.string, | ||
type: PropTypes.oneOf(['text', 'password']), | ||
name: PropTypes.string.isRequired, | ||
onChange: PropTypes.func.isRequired | ||
} | ||
|
||
// https://reactjs.org/docs/react-without-es6.html#declaring-default-props | ||
static defaultProps = { | ||
theme: 'light', | ||
type: 'text' | ||
} | ||
|
||
render() { | ||
const { theme, type, className, ...rest } = this.props; | ||
|
||
const inputTextClass = classNames( | ||
'form-control', | ||
`form-control--${theme}`, | ||
className | ||
); | ||
|
||
return ( | ||
<input | ||
className={ inputTextClass } | ||
type={ type } | ||
{ ...rest } | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default InputText; |
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,81 @@ | ||
// useful reference about how to define input radio | ||
// http://react.tips/radio-buttons-in-reactjs/ | ||
|
||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
/* | ||
usage: | ||
<InputRadio | ||
theme={ theme } | ||
label="Input Radio Label" | ||
name="sameAttributeNameFromState" | ||
value="valueAssignedToTheInputRadio" | ||
selected={ this.state.sameAttributeNameFromState } | ||
onChange={ this.handleChange } | ||
/> | ||
*/ | ||
class InputRadio extends Component { | ||
|
||
// https://reactjs.org/docs/typechecking-with-proptypes.html | ||
static propTypes = { | ||
theme: PropTypes.string, | ||
label: PropTypes.string, | ||
name: PropTypes.string, | ||
value: PropTypes.string, | ||
selected: PropTypes.string, | ||
onChange: PropTypes.func | ||
} | ||
|
||
// https://reactjs.org/docs/react-without-es6.html#declaring-default-props | ||
static defaultProps = { | ||
theme: 'light' | ||
} | ||
|
||
handleClick = (event) => { | ||
event.preventDefault(); | ||
const { onChange, name, value } = this.props; | ||
if( onChange ) { | ||
onChange({ target: { name, value } }); | ||
} | ||
} | ||
|
||
render() { | ||
const { | ||
theme, label, | ||
className, | ||
name, value, | ||
selected, | ||
...rest | ||
} = this.props; | ||
|
||
const inputRadioClass = classNames( | ||
'form-check', | ||
`form-check--${theme}`, | ||
className | ||
); | ||
|
||
return ( | ||
<div | ||
className={ inputRadioClass } | ||
onClick={ this.handleClick }> | ||
<input | ||
className="form-check-input" | ||
type="radio" | ||
id={ name } | ||
checked={ value === selected } | ||
{ ...{ name, value, ...rest } } | ||
/> | ||
<label | ||
className="form-check-label" | ||
htmlFor={ name }> | ||
{ label } | ||
</label> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default InputRadio; |
Oops, something went wrong.