Skip to content

Commit

Permalink
feat: replace coffeescript with javascript at all files
Browse files Browse the repository at this point in the history
  • Loading branch information
kelp404 committed Apr 5, 2020
1 parent 744d653 commit 3b79e22
Show file tree
Hide file tree
Showing 33 changed files with 327 additions and 947 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ end_of_line = lf
insert_final_newline = true

# 2 space indentation
[*.{coffee,html,yml,json,md}]
[*.{html,js,json,yml,md}]
indent_style = space
indent_size = 2

Expand Down
4 changes: 0 additions & 4 deletions config/default.coffee

This file was deleted.

6 changes: 6 additions & 0 deletions config/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
server: {
host: '0.0.0.0',
port: 8000
}
};
28 changes: 0 additions & 28 deletions example/app.coffee

This file was deleted.

72 changes: 35 additions & 37 deletions example/app.js

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
Expand All @@ -19,11 +19,13 @@
</head>
<body>
<div id="root">
<p class="text-center text-muted h3" style="padding: 20px 0">
<i class="fa fa-spinner fa-pulse fa-fw"></i> Loading...
</p>
<div className="text-center text-muted py-5">
<div className="spinner-border">
<span className="sr-only">Loading...</span>
</div>
</div>
</div>
<a href="https://github.com/kelp404/capybara-router"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
<script type="text/javascript" src="//localhost:8001/app.js"></script>
<script type="text/javascript" src="//localhost:8001/web.js"></script>
</body>
</html>
56 changes: 0 additions & 56 deletions example/pages/base.coffee

This file was deleted.

64 changes: 64 additions & 0 deletions example/pages/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const classNames = require('classnames');
const React = require('react');
const {RouterView, Link, getRouter} = require('../../');

module.exports = class Base extends React.Component {
state = {currentRouteName: null};

constructor(props) {
super(props);
const router = getRouter();
this.listens = [
router.listen('ChangeSuccess', (action, toState) => {
this.setState({currentRouteName: toState.name});
})
];
}

componentWillUnmount() {
this.listens.map(x => x());
}

render() {
const {currentRouteName} = this.state;

return (
<>
<nav className="navbar navbar-default">
<div className="container">
<div className="navbar-header">
<button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span className="sr-only">Toggle navigation</span>
<span className="icon-bar"/>
<span className="icon-bar"/>
<span className="icon-bar"/>
</button>
<Link className="navbar-brand" to="/capybara-router/">capybara-router</Link>
</div>

<div className="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul className="nav navbar-nav">
<li className={classNames({active: currentRouteName === 'web.home'})}>
<Link to="/capybara-router/">Home</Link>
</li>
<li className={classNames({active: ['web.users', 'web.user'].indexOf(currentRouteName) >= 0})}>
<Link to="/capybara-router/users">Users</Link>
</li>
<li><Link to="/capybara-router/404">404</Link></li>
<li><Link to="/capybara-router/error">Error</Link></li>
</ul>
</div>
</div>
</nav>

<div className="container">
<div className="row">
<div className="col-sm-12">
<RouterView/>
</div>
</div>
</div>
</>
);
}
};
6 changes: 0 additions & 6 deletions example/pages/error-page.coffee

This file was deleted.

20 changes: 20 additions & 0 deletions example/pages/error-page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const PropTypes = require('prop-types');
const React = require('react');

module.exports = class ErrorPage extends React.Component {
static get propTypes() {
return {error: PropTypes.any.isRequired};
}

shouldComponentUpdate() {
return false;
}

render() {
const {error} = this.props;

return (
<h2 className="text-center">{`${error}`}</h2>
);
}
};
6 changes: 0 additions & 6 deletions example/pages/home.coffee

This file was deleted.

11 changes: 11 additions & 0 deletions example/pages/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const React = require('react');

module.exports = class Home extends React.Component {
shouldComponentUpdate() {
return false;
}

render() {
return <h2>Home</h2>;
}
};
6 changes: 0 additions & 6 deletions example/pages/not-found.coffee

This file was deleted.

11 changes: 11 additions & 0 deletions example/pages/not-found.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const React = require('react');

module.exports = class NotFound extends React.Component {
shouldComponentUpdate() {
return false;
}

render() {
return <h2 className="text-center">Not Found</h2>;
}
};
23 changes: 0 additions & 23 deletions example/pages/user.coffee

This file was deleted.

35 changes: 35 additions & 0 deletions example/pages/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const PropTypes = require('prop-types');
const React = require('react');

module.exports = class Users extends React.PureComponent {
static get propTypes() {
return {
user: PropTypes.shape({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
email: PropTypes.string.isRequired
}).isRequired
};
}

render() {
const {user} = this.props;

return (
<>
<div className="form-group">
<label className="control-label">ID</label>
<p className="form-control-static">{user.id}</p>
</div>
<div className="form-group">
<label className="control-label">Name</label>
<p className="form-control-static">{user.name}</p>
</div>
<div className="form-group">
<label className="control-label">Email</label>
<p className="form-control-static">{user.email}</p>
</div>
</>
);
}
};
31 changes: 0 additions & 31 deletions example/pages/users.coffee

This file was deleted.

Loading

0 comments on commit 3b79e22

Please sign in to comment.