This repository has been archived by the owner on Jan 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
115 changed files
with
2,959 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. | ||
# Requires EditorConfig JetBrains Plugin - http://github.com/editorconfig/editorconfig-jetbrains | ||
|
||
# Set this file as the topmost .editorconfig | ||
# (multiple files can be used, and are applied starting from current document location) | ||
root = true | ||
|
||
[{package.json}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# Use bracketed regexp to target specific file types or file locations | ||
[*.{js,json}] | ||
|
||
# Use hard or soft tabs ["tab", "space"] | ||
indent_style = space | ||
|
||
# Size of a single indent [an integer, "tab"] | ||
indent_size = tab | ||
|
||
# Number of columns representing a tab character [an integer] | ||
tab_width = 4 | ||
|
||
# Line breaks representation ["lf", "cr", "crlf"] | ||
end_of_line = lf | ||
|
||
# ["latin1", "utf-8", "utf-16be", "utf-16le"] | ||
charset = utf-8 | ||
|
||
# Remove any whitespace characters preceding newline characters ["true", "false"] | ||
trim_trailing_whitespace = true | ||
|
||
# Ensure file ends with a newline when saving ["true", "false"] | ||
insert_final_newline = 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
*.log | ||
.DS_Store | ||
lib | ||
esdocs | ||
coverage | ||
build |
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,9 @@ | ||
sudo: required | ||
language: node_js | ||
node_js: | ||
- 4.2 | ||
- stable | ||
before_script: | ||
- npm run link | ||
after_success: | ||
- npm run build |
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 |
---|---|---|
@@ -1 +1,6 @@ | ||
# roc-package-web-app-react | ||
# roc-package-web-app-react | ||
[](https://travis-ci.org/rocjs/roc-package-web-app-react) | ||
|
||
__Package for building React applications with Roc__ | ||
- [roc-package-web-app-react](/packages/roc-package-web-app-react) | ||
- [roc-package-web-app-react-dev](/packages/roc-package-web-app-react-dev) |
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 @@ | ||
Not all examples are fully updated to use the latest code, please be aware. |
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,9 @@ | ||
{ | ||
"DANGEROUSLY_EXPOSE_TO_CLIENT": { | ||
"foo": "bar" | ||
}, | ||
"auth": { | ||
"publicKey": "1", | ||
"privateKey": "foobar" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
Hello |
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,16 @@ | ||
{ | ||
"name": "roc-web-react-complex-example", | ||
"version": "1.0.0", | ||
"description": "Roc Web React complex example", | ||
"author": "VG", | ||
"license": "MIT", | ||
"dependencies": { | ||
"redux-fetcher": "~1.0.1", | ||
"redux-api-middleware": "vgno/redux-api-middleware#v1.0.0-beta5", | ||
"roc-package-web-app-react": "*" | ||
}, | ||
"devDependencies": { | ||
"roc-package-web-app-react-dev": "*", | ||
"roc-plugin-style-sass": "*" | ||
} | ||
} |
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,14 @@ | ||
module.exports = { | ||
settings: { | ||
runtime: { | ||
applicationName: 'My Roc Application', | ||
serve: ['files', 'build/client'] | ||
}, | ||
build: { | ||
koaMiddlewares: 'src/koa-middlewares.js', | ||
reduxMiddlewares: 'src/middlewares.js', | ||
reducers: 'src/reducers.js', | ||
routes: 'src/routes.js' | ||
} | ||
} | ||
}; |
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,19 @@ | ||
import React, { Component } from 'react'; | ||
import { defer } from 'react-fetcher'; | ||
|
||
@defer(() => new Promise((resolve) => { | ||
setTimeout(() => { | ||
console.log('Completed!'); | ||
resolve(); | ||
}, 2000); | ||
})) | ||
export default class About extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
<h1>About us</h1> | ||
<img src="favicon.png" /> | ||
</div> | ||
); | ||
} | ||
} |
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,22 @@ | ||
import React, { Component } from 'react'; | ||
import { IndexLink, Link } from 'react-router'; | ||
|
||
export default class App extends Component { | ||
static propTypes = { | ||
children: React.PropTypes.object | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<nav> | ||
<ul> | ||
<li><IndexLink to="/">Home</IndexLink></li> | ||
<li><Link to="/about/">About</Link></li> | ||
</ul> | ||
</nav> | ||
{ this.props.children } | ||
</div> | ||
); | ||
} | ||
} |
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,68 @@ | ||
import React, { Component } from 'react'; | ||
|
||
export default class Bacon extends Component { | ||
render() { | ||
/* eslint-disable max-len */ | ||
return ( | ||
<div> | ||
<h1>Bacon ipsum dolor</h1> | ||
<p> | ||
Bacon ipsum dolor amet hamburger swine filet mignon biltong shank, turkey alcatra brisket flank ribeye | ||
landjaeger beef ribs. Ham flank pancetta biltong pork belly shankle brisket doner beef. Pig sirloin turkey | ||
corned beef, alcatra biltong boudin pastrami. Tail pig pork filet mignon kevin chuck. Prosciutto ball tip | ||
flank jerky ham, porchetta fatback kevin swine alcatra spare ribs pancetta. Pork belly tenderloin meatball | ||
venison filet mignon andouille doner pork loin turducken strip steak. Shank andouille pig shankle. | ||
|
||
Drumstick shankle tri-tip pork chop salami bacon jowl. Shankle bacon tongue venison, brisket strip steak | ||
cupim meatball. Flank turducken tenderloin rump pork belly ribeye. Drumstick tenderloin turkey, short loin | ||
andouille meatloaf meatball brisket bresaola rump jowl. Drumstick tongue ball tip t-bone leberkas rump. | ||
|
||
Porchetta pastrami cow, short loin rump landjaeger brisket tongue beef bresaola pork chop drumstick. Swine | ||
t-bone tongue pork belly ham turducken alcatra rump pork loin flank ribeye meatloaf capicola short ribs. | ||
Flank ribeye shank, turkey pork chop tail tongue hamburger swine. Ham hock jowl meatloaf ham cow, rump | ||
drumstick shankle flank hamburger fatback prosciutto biltong. | ||
|
||
Landjaeger bacon kevin sausage, tail bresaola shank alcatra pastrami jerky. Kielbasa salami landjaeger | ||
ground round. Chicken ham brisket, boudin andouille corned beef jerky tri-tip short ribs kielbasa | ||
landjaeger beef biltong jowl bacon. Pork shank leberkas, picanha beef ribs spare ribs cow beef drumstick | ||
ball tip shankle short loin ground round pig. Picanha ground round venison pancetta drumstick ham biltong | ||
bresaola salami sausage beef ribs boudin pork chop jerky. Brisket jowl chicken, kevin tongue beef | ||
prosciutto meatloaf. | ||
|
||
Frankfurter meatball sausage turkey rump ham hock tongue doner leberkas drumstick jowl ground round filet | ||
mignon. Tenderloin sirloin salami, shoulder ham landjaeger corned beef pastrami cow porchetta capicola | ||
boudin tongue rump. Pork loin sirloin rump landjaeger drumstick pastrami frankfurter andouille doner | ||
salami flank shoulder. Fatback bacon turducken frankfurter. Pancetta ground round flank pork, sausage pork | ||
chop doner bacon ribeye shank tail filet mignon jowl swine short ribs. Jerky shank prosciutto ham hock | ||
kevin picanha meatball short loin pork loin shankle ground round brisket pork belly. | ||
|
||
Chuck pig tri-tip, doner meatloaf rump ball tip tenderloin venison leberkas. Pork loin biltong t-bone | ||
turducken. Jerky pork loin pork short ribs pastrami biltong, turkey meatball kevin sausage. Alcatra strip | ||
steak corned beef, beef ribs andouille tenderloin biltong ribeye chuck. Doner chuck biltong venison pork | ||
belly tail fatback cow t-bone short ribs ham hock jowl hamburger frankfurter meatball. | ||
|
||
Sausage beef ribs tail shoulder pork belly shank prosciutto pork tri-tip sirloin t-bone. Ground round spare | ||
ribs turducken tongue. Shank tenderloin meatloaf, beef tongue beef ribs pastrami. Porchetta short ribs | ||
sirloin, bacon drumstick prosciutto doner kevin pancetta tri-tip fatback. | ||
|
||
Meatloaf salami biltong shank, venison cow drumstick picanha capicola doner short loin. Doner filet mignon | ||
biltong meatloaf. Filet mignon ribeye tail porchetta strip steak shoulder chicken short ribs. Strip steak | ||
tenderloin pig filet mignon spare ribs, capicola pork loin prosciutto ground round leberkas tail chuck | ||
porchetta biltong. Corned beef brisket frankfurter tongue capicola venison. Tail jowl ham venison. | ||
|
||
Venison spare ribs shank beef ribs sausage pork chop capicola jerky. Sirloin spare ribs ribeye strip steak | ||
cow beef fatback brisket pork ball tip doner hamburger. Pork loin fatback swine kielbasa doner alcatra | ||
salami porchetta drumstick tongue ground round. Strip steak sausage sirloin rump shoulder t-bone. Meatloaf | ||
corned beef sausage, chuck ground round short ribs porchetta tri-tip. Hamburger kielbasa cow, picanha | ||
boudin capicola rump pastrami ball tip pork chop swine. | ||
|
||
Chuck landjaeger pork, pork loin shankle tri-tip pastrami flank kielbasa picanha drumstick cupim chicken | ||
beef. Pork loin frankfurter short loin, pancetta cupim ribeye jerky turkey beef ribs tri-tip meatball | ||
swine tail flank. Pastrami salami turkey, turducken ball tip venison meatloaf sirloin pork chop drumstick | ||
short loin. Andouille sirloin pig, tongue pork chop pastrami meatball filet mignon beef ribs chuck fatback. | ||
</p> | ||
</div> | ||
); | ||
/* eslint-enable max-len */ | ||
} | ||
} |
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,19 @@ | ||
import React, { Component } from 'react'; | ||
|
||
export default class Clicker extends Component { | ||
static propTypes = { | ||
clicker: React.PropTypes.number.isRequired, | ||
click: React.PropTypes.func.isRequired | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<h1>Clicker</h1> | ||
<div> | ||
{ this.props.clicker } <button onClick={ this.props.click }>Click me!</button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
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,31 @@ | ||
import React, { Component } from 'react'; | ||
|
||
import ErrorItem from './item'; | ||
|
||
export default class Errors extends Component { | ||
static defaultProps = { | ||
errors: [] | ||
}; | ||
|
||
static propTypes = { | ||
errors: React.PropTypes.array, | ||
resetErrors: React.PropTypes.func | ||
}; | ||
|
||
render() { | ||
const errorList = this.props.errors.map((error, i) => ( | ||
<ErrorItem key= { i } error={ JSON.stringify(error) }/> | ||
)); | ||
|
||
if (errorList.length > 0) { | ||
return ( | ||
<div> | ||
{ errorList } | ||
<button onClick={ this.props.resetErrors }>Reset Errors</button> | ||
</div> | ||
); | ||
} | ||
|
||
return false; | ||
} | ||
} |
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,24 @@ | ||
import React, { Component } from 'react'; | ||
|
||
import styles from './style.css'; | ||
|
||
export default class ErrorItem extends Component { | ||
static defaultProps = { | ||
key: 0, | ||
error: '' | ||
}; | ||
|
||
static propTypes = { | ||
key: React.PropTypes.number.isRequired, | ||
error: React.PropTypes.string.isRequired | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div key={ this.props.key } className={styles.error}> | ||
<h2>Error</h2> | ||
<p>{ this.props.error }</p> | ||
</div> | ||
); | ||
} | ||
} |
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,7 @@ | ||
.error { | ||
background: #ff0000; | ||
color: #fff; | ||
padding: 5px; | ||
margin: 0 0 10px 0; | ||
border-radius: 8px; | ||
} |
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,5 @@ | ||
export function resetErrors() { | ||
return { | ||
type: 'RESET_ERROR_MESSAGES' | ||
}; | ||
} |
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,74 @@ | ||
import React from 'react'; | ||
import { bindActionCreators } from 'redux'; | ||
import { connect } from 'react-redux'; | ||
import { prefetch } from 'react-fetcher'; | ||
|
||
// components | ||
import Weather from '../weather'; | ||
import Clicker from '../clicker'; | ||
import Bacon from '../bacon'; | ||
import Errors from '../errors'; | ||
|
||
// this generates fetch actions | ||
import { createFetchAction } from 'redux-fetcher' | ||
|
||
// roc error action | ||
import { resetErrors } from './actions'; | ||
|
||
// clicker reducer | ||
import { click } from '../../reducers/clicker'; | ||
|
||
// util | ||
import { prefetchWeather, mergeWeatherProps } from './util'; | ||
|
||
import styles from './style.css'; | ||
|
||
// this maps values from redux store to props of this component | ||
function mapStateToProps(state) { | ||
return { | ||
clicker: state.clicker, | ||
weather: state.weather, | ||
errors: state.errors | ||
}; | ||
} | ||
|
||
// this maps action creators to dispatch, available as props on component | ||
function mapDispatchToProps(dispatch) { | ||
return bindActionCreators({ click, resetErrors, createFetchAction }, dispatch); | ||
} | ||
|
||
// prefetch triggers on both server and client | ||
@prefetch(prefetchWeather) | ||
// mergeWeatherProps enriches dispatch props with weatherForceFetch | ||
@connect(mapStateToProps, mapDispatchToProps, mergeWeatherProps) | ||
export default class Main extends React.Component { | ||
static propTypes = { | ||
// bound actions | ||
click: React.PropTypes.func.isRequired, | ||
resetErrors: React.PropTypes.func.isRequired, | ||
createFetchAction: React.PropTypes.func.isRequired, | ||
weatherForceFetch: React.PropTypes.func.isRequired, | ||
// connected values from store | ||
clicker: React.PropTypes.number, | ||
weather: React.PropTypes.object, | ||
errors: React.PropTypes.array | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div className={styles.main}> | ||
<img src="/favicon.png" /> | ||
<Errors errors={ this.props.errors } resetErrors= { this.props.resetErrors }/> | ||
<Clicker clicker={ this.props.clicker } click={ this.props.click }/> | ||
<Weather | ||
payload={ this.props.weather.payload } | ||
loading= { this.props.weather.loading } | ||
endpoint={ this.props.weather.endpoint } | ||
error={ this.props.weather.error } | ||
fetchWeatherData={ this.props.weatherForceFetch } | ||
/> | ||
<Bacon/> | ||
</div> | ||
); | ||
} | ||
} |
Oops, something went wrong.