Commit aab963ba authored by Remo Jansen's avatar Remo Jansen

fixed react addons classset deprecated

parent 74433b6e
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<script src="node_modules/todomvc-common/base.js"></script> <script src="node_modules/todomvc-common/base.js"></script>
<script src="node_modules/react/dist/react-with-addons.js"></script> <script src="node_modules/react/dist/react-with-addons.js"></script>
<script src="node_modules/classnames/index.js"></script>
<script src="node_modules/react/dist/JSXTransformer.js"></script> <script src="node_modules/react/dist/JSXTransformer.js"></script>
<script src="node_modules/director/build/director.js"></script> <script src="node_modules/director/build/director.js"></script>
......
...@@ -23,8 +23,6 @@ var app = app || {}; ...@@ -23,8 +23,6 @@ var app = app || {};
); );
} }
// React idiom for shortcutting to `classSet` since it'll be used often
var cx = React.addons.classSet;
var nowShowing = this.props.nowShowing; var nowShowing = this.props.nowShowing;
return ( return (
<footer className="footer"> <footer className="footer">
...@@ -35,7 +33,7 @@ var app = app || {}; ...@@ -35,7 +33,7 @@ var app = app || {};
<li> <li>
<a <a
href="#/" href="#/"
className={cx({selected: nowShowing === app.ALL_TODOS})}> className={classNames({selected: nowShowing === app.ALL_TODOS})}>
All All
</a> </a>
</li> </li>
...@@ -43,7 +41,7 @@ var app = app || {}; ...@@ -43,7 +41,7 @@ var app = app || {};
<li> <li>
<a <a
href="#/active" href="#/active"
className={cx({selected: nowShowing === app.ACTIVE_TODOS})}> className={classNames({selected: nowShowing === app.ACTIVE_TODOS})}>
Active Active
</a> </a>
</li> </li>
...@@ -51,7 +49,7 @@ var app = app || {}; ...@@ -51,7 +49,7 @@ var app = app || {};
<li> <li>
<a <a
href="#/completed" href="#/completed"
className={cx({selected: nowShowing === app.COMPLETED_TODOS})}> className={classNames({selected: nowShowing === app.COMPLETED_TODOS})}>
Completed Completed
</a> </a>
</li> </li>
......
...@@ -77,7 +77,7 @@ var app = app || {}; ...@@ -77,7 +77,7 @@ var app = app || {};
render: function () { render: function () {
return ( return (
<li className={React.addons.classSet({ <li className={classNames({
completed: this.props.todo.completed, completed: this.props.todo.completed,
editing: this.props.editing editing: this.props.editing
})}> })}>
......
/*!
Copyright (c) 2015 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = '';
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes += ' ' + arg;
} else if (Array.isArray(arg)) {
classes += ' ' + classNames.apply(null, arg);
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes += ' ' + key;
}
}
}
}
return classes.substr(1);
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
// register as 'classnames', consistent with npm package name
define('classnames', function () {
return classNames;
});
} else {
window.classNames = classNames;
}
}());
{ {
"private": true, "private": true,
"dependencies": { "dependencies": {
"classnames": "^2.1.5",
"director": "^1.2.0", "director": "^1.2.0",
"react": "^0.13.3", "react": "^0.13.3",
"todomvc-app-css": "^2.0.0", "todomvc-app-css": "^2.0.0",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment