-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replace coffeescript with javascript at all files
- Loading branch information
Showing
33 changed files
with
327 additions
and
947 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
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,6 @@ | ||
module.exports = { | ||
server: { | ||
host: '0.0.0.0', | ||
port: 8000 | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
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
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,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> | ||
</> | ||
); | ||
} | ||
}; |
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,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> | ||
); | ||
} | ||
}; |
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,11 @@ | ||
const React = require('react'); | ||
|
||
module.exports = class Home extends React.Component { | ||
shouldComponentUpdate() { | ||
return false; | ||
} | ||
|
||
render() { | ||
return <h2>Home</h2>; | ||
} | ||
}; |
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,11 @@ | ||
const React = require('react'); | ||
|
||
module.exports = class NotFound extends React.Component { | ||
shouldComponentUpdate() { | ||
return false; | ||
} | ||
|
||
render() { | ||
return <h2 className="text-center">Not Found</h2>; | ||
} | ||
}; |
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,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> | ||
</> | ||
); | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.