Skip to content

Commit

Permalink
Merge pull request #691 from didi0613/update-sample-demo-component
Browse files Browse the repository at this point in the history
[major] update sample demo component to React 16
  • Loading branch information
jchip committed Jan 20, 2018
2 parents b5cfa08 + 09f05bc commit 44f319b
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const repoPackagesDir = Path.join(__dirname, "../../../../packages");
module.exports = {
resolve: {
alias: {
"demo-component": Path.join(repoPackagesDir, "demo-component/src")
"demo-component": Path.join(repoPackagesDir, "demo-component/src"),
"react": Path.dirname(require.resolve("react/package.json")),
"react-dom": Path.dirname(require.resolve("react-dom/package.json"))
},
modules: [
Path.join(repoPackagesDir, "demo-component"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const repoPackagesDir = Path.join(__dirname, "../../../../packages");
module.exports = {
resolve: {
alias: {
"demo-component": Path.join(repoPackagesDir, "demo-component/src")
"demo-component": Path.join(repoPackagesDir, "demo-component/src"),
"react": Path.dirname(require.resolve("react/package.json")),
"react-dom": Path.dirname(require.resolve("react-dom/package.json"))
},
modules: [
Path.join(repoPackagesDir, "demo-component"),
Expand Down
10 changes: 4 additions & 6 deletions samples/demo-component/demo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,15 @@
"dependencies": {
"bluebird": "^3.4.6",
"electrode-archetype-react-app": "../../../packages/electrode-archetype-react-app",
"electrode-confippet": "^1.0.0",
"electrode-react-webapp": "^1.1.0",
"electrode-redux-router-engine": "^1.2.2",
"electrode-confippet": "^1.5.0",
"electrode-react-webapp": "../../../packages/electrode-react-webapp",
"electrode-redux-router-engine": "../../../packages/electrode-redux-router-engine",
"electrode-server": "^1.0.0",
"electrode-static-paths": "^1.0.0",
"lodash": "^4.10.1"
},
"devDependencies": {
"electrode-archetype-react-app-dev": "../../../packages/electrode-archetype-react-app-dev",
"json-stringify-safe": "^5.0.1",
"safe-json-stringify": "^1.0.4"
"electrode-archetype-react-app-dev": "../../../packages/electrode-archetype-react-app-dev"
},
"private": true
}
8 changes: 5 additions & 3 deletions samples/demo-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
},
"dependency": {},
"devDependencies": {
"lerna": "^2.0.0-rc.1",
"lodash": "^4.10.1"
}
"lerna": "^2.7.1",
"lodash": "^4.10.1",
"xclap": "^0.2.0"
},
"private": true
}
3 changes: 1 addition & 2 deletions samples/demo-component/packages/demo-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
},
"homepage": "https://github.com/electrode-io/electrode",
"dependencies": {
"material-ui": "^0.18.3",
"react-tap-event-plugin": "^2.0.1"
"material-ui": "^0.20.0"
},
"devDependencies": {
"electrode-archetype-react-component": "../../../../packages/electrode-archetype-react-component",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ import MenuItem from "material-ui/MenuItem";
import MoreVertIcon from "material-ui/svg-icons/navigation/more-vert";
import NavigationClose from "material-ui/svg-icons/navigation/close";

const AppBarExampleIconMenu = () =>
<AppBar
title="Electrode React Sample Component with material-ui"
iconElementLeft={<IconButton><NavigationClose /></IconButton>}
iconElementRight={
<IconMenu
iconButtonElement={<IconButton><MoreVertIcon /></IconButton>}
targetOrigin={{ horizontal: "right", vertical: "top" }}
anchorOrigin={{ horizontal: "right", vertical: "top" }}
>
<MenuItem primaryText="Refresh" />
<MenuItem primaryText="Help" />
<MenuItem primaryText="Sign out" />
</IconMenu>
}
/>;
const AppBarExampleIconMenu = () => {
return (
<AppBar
title="Electrode React Sample Component with material-ui"
iconElementLeft={<IconButton><NavigationClose /></IconButton>}
iconElementRight={
<IconMenu
iconButtonElement={<IconButton><MoreVertIcon /></IconButton>}
targetOrigin={{ horizontal: "right", vertical: "top" }}
anchorOrigin={{ horizontal: "right", vertical: "top" }}
>
<MenuItem primaryText="Refresh" />
<MenuItem primaryText="Help" />
<MenuItem primaryText="Sign out" />
</IconMenu>
}
/>
);
};

export default AppBarExampleIconMenu;
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@ import avatarJpg from "../../images/jchip-128.jpg";
import { FormattedMessage } from "react-intl";
import messages from "../lang/default-messages";

const CardExampleWithAvatar = () =>
<Card>
<CardHeader title="URL Avatar" subtitle="Subtitle" avatar={avatarJpg} />
<CardMedia overlay={<CardTitle title="Overlay title" subtitle="Overlay subtitle" />}>
<img src={natureJpg} />
</CardMedia>
<CardTitle title="Card title" subtitle="Card subtitle" />
<CardText>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi.
Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque.
Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio.<p />
<FormattedMessage {...messages.editMe} />
const CardExampleWithAvatar = () => {
return (
<Card>
<CardHeader title="URL Avatar" subtitle="Subtitle" avatar={avatarJpg} />
<CardMedia overlay={<CardTitle title="Overlay title" subtitle="Overlay subtitle" />}>
<img src={natureJpg} />
</CardMedia>
<CardTitle title="Card title" subtitle="Card subtitle" />
<CardText>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi.
Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque.
Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio.<p />
<FormattedMessage {...messages.editMe} />

</CardText>
<CardActions>
<FlatButton label="Action1" />
<FlatButton label="Action2" />
</CardActions>
</Card>;
</CardText>
<CardActions>
<FlatButton label="Action1" />
<FlatButton label="Action2" />
</CardActions>
</Card>
);
};

export default CardExampleWithAvatar;
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const { intl } = intlProvider.getChildContext();
/*
When using React-Intl `injectIntl` on components, props.intl is required.
*/
const nodeWithIntlProp = (node) => {
const nodeWithIntlProp = node => {
return React.cloneElement(node, { intl });
};

const shallowWithIntl = (node) => {
const shallowWithIntl = node => {
return shallow(
nodeWithIntlProp(node),
{
Expand All @@ -32,7 +32,7 @@ const shallowWithIntl = (node) => {
);
};

const mountWithIntl = (node) => {
const mountWithIntl = node => {
return mount(
nodeWithIntlProp(node),
{
Expand Down

0 comments on commit 44f319b

Please sign in to comment.