Skip to content

Commit ee094b2

Browse files
committed
Added Semantic-UI, code refactoring
1 parent 426c162 commit ee094b2

File tree

7 files changed

+44
-41
lines changed

7 files changed

+44
-41
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ npm install
66

77
Usage:
88

9-
```bash
10-
npm run-script serve
9+
```
10+
$ broccoli serve
1111
```
1212

1313
Open `http://localhost:4200`
1414

15-
or
15+
If you like to use the build
1616

1717
```
18-
$ npm run-script bundle
18+
$ broccoli build dist
1919
$ http-server dist/
2020
```
21+
2122
and open `http://localhost:8080`
2223

2324
Test:
@@ -26,14 +27,18 @@ Test:
2627
$ npm test
2728
```
2829

29-
* All JavaScript files are transpiled with 6to5 library with enabled experimental ES7 syntax (see: https://6to5.org/features.html).
30-
* For using experimental ES7 code in `Jest` tests, the project is using my fork of `6to5-jest`package (https://github.com/hipertracker/6to5-jest)
31-
* The workflow and communication between components is built using `Reflux` (https://github.com/spoike/refluxjs), a slighty modified (improved) Flux paradigm. See: http://blog.krawaller.se/posts/reflux-refinement/
30+
Currently just a simple example of using unit tests in React for files using ES6/ES7 syntax.
31+
32+
Details
33+
34+
* All JavaScript files are transpiled with [6to5](https://6to5.org/) library with enabled [experimental ES7 syntax](https://6to5.org/features.html).
35+
* For using experimental ES7 code in [Jest](http://facebook.github.io/jest/docs/tutorial-react.html) tests, the project is using [my fork](https://github.com/hipertracker/6to5-jest) of `6to5-jest` package.
36+
* The workflow and communication between components is built using [Reflux](https://github.com/spoike/refluxjs), a slighty [improved](http://blog.krawaller.se/posts/reflux-refinement/) Flux paradigm.
3237
* Unit testing is provided by `Jest` (https://facebook.github.io/jest/)
33-
* The example is using Bootstrap 3 React components thanks to `react-bootstrap` (http://react-bootstrap.github.io/).
38+
* Using [Semantic-UI](http://semantic-ui.com/) framework with React components ([react-semantify](http://react-components.com/component/react-semantify))
3439

3540
Todo:
3641

37-
* Add more unit tests showing `Jest` testing ES5/ES7 code.
38-
* Add `Yeoman` project with options to choose SASS/Less/Stylus and Bootstrap/Semantic-UI
42+
* Add more unit tests showing [Jest](http://facebook.github.io/jest/) testing ES5/ES7 code.
43+
* Add [Yeoman](http://yeoman.io/) project with options to choose SASS/Less/Stylus and Bootstrap/Semantic-UI
3944

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
"lodash": "^2.4.1",
4747
"react": "*",
4848
"react-router": "^0.11.6",
49+
"react-semantify": "^0.2.2",
50+
"reactify": "^0.17.1",
4951
"reflux": "*",
5052
"rimraf": "^2.2.8"
5153
}

src/app/components/About.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
const React = require('react');
2+
const {Segment} = require('react-semantify');
23

34
const About = React.createClass({
45
render() {
56
return (
6-
<section>
7+
<Segment>
78
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ligula eros, sollicitudin nec libero non, cursus fringilla lectus. Aliquam volutpat velit feugiat pellentesque lobortis. Pellentesque pulvinar ornare ligula, sit amet imperdiet nibh tincidunt et. Suspendisse suscipit dolor vel turpis viverra ullamcorper. Fusce in enim elementum, hendrerit enim ut, pretium ipsum. Sed malesuada justo nec augue sodales, eu luctus dolor vulputate. Nunc ut consequat ipsum. Nam tempor fermentum risus at dictum. Sed et diam metus. Donec ac nisi suscipit, tristique enim sit amet, hendrerit ante. Pellentesque nec augue malesuada, ultrices dolor a, placerat ex. Pellentesque imperdiet feugiat nunc.
8-
</section>
9+
</Segment>
910
)
1011
}
1112
});

src/app/components/App.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
const React = require('react');
2-
const RouteHandler = require('react-router').RouteHandler;
3-
import Menu from './Menu';
2+
const ReactRouter = require('react-router')
3+
const {Menu, Segment} = require('react-semantify');
4+
5+
let RouteHandler = ReactRouter.RouteHandler;
6+
let Link = ReactRouter.Link;
47

58
const App = React.createClass({
69
render() {
@@ -9,8 +12,20 @@ const App = React.createClass({
912
};
1013
return (
1114
<section style={styles}>
12-
<Menu/>
15+
<Menu>
16+
<Link to="home" className="item">
17+
<i className="home icon"></i>
18+
Home
19+
</Link>
20+
<Link to="about" className="item">
21+
<i className="bomb icon"></i>
22+
About
23+
</Link>
24+
</Menu>
1325
<RouteHandler/>
26+
<Segment>
27+
Git: <a href="https://github.com/hipertracker/react-es7">https://github.com/hipertracker/react-es7</a>
28+
</Segment>
1429
</section>
1530
)
1631
}

src/app/components/Home.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
const React = require('react');
22
import UsefulLinks from './UsefulLinks';
3+
const {Segment} = require('react-semantify');
34

45
const Home = React.createClass({
56
render() {
67
return (
7-
<section>
8-
<UsefulLinks title="Useful Links"/>
9-
</section>
8+
<Segment>
9+
<UsefulLinks title="React useful links"/>
10+
</Segment>
1011
)
1112
}
1213
});

src/app/components/Menu.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/app/components/UsefulLinks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ const UsefulLinks = React.createClass({
3434
let style = m(styles.item, this.props.style);
3535
let items = this.state.links.map((item, key) =>
3636
<li key={key}>
37-
<a href={item.url} target="_blank">{item.title}</a>
37+
{item.title} (<a href={item.url} target="_blank">{item.url}</a>)
3838
</li>);
3939
return (
4040
<div>
41-
<h4>{this.props.title}</h4>
41+
<b>{this.props.title}</b>
4242
<ul style={style}>{items}</ul>
4343
</div>
4444
);

0 commit comments

Comments
 (0)