Skip to content

Commit

Permalink
Merge pull request mui#3089 from oliviertassinari/es6-classes
Browse files Browse the repository at this point in the history
[ES6] Apply jscodeshift to use classes
  • Loading branch information
oliviertassinari committed Jan 29, 2016
2 parents f0ebb90 + cbad9cf commit e12a66c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 45 deletions.
15 changes: 7 additions & 8 deletions docs/src/app/components/CodeExample/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ import CodeBlock from './CodeBlock';
import ClearFix from 'material-ui/lib/clearfix';
import Paper from 'material-ui/lib/paper';

const CodeExample = React.createClass({

propTypes: {
class CodeExample extends React.Component {
static propTypes = {
children: React.PropTypes.node,
code: React.PropTypes.string.isRequired,
description: React.PropTypes.string,
layoutSideBySide: React.PropTypes.bool,
title: React.PropTypes.string,
},
};

contextTypes: {
static contextTypes = {
muiTheme: React.PropTypes.object,
},
};

render() {

Expand Down Expand Up @@ -48,7 +47,7 @@ const CodeExample = React.createClass({
<ClearFix style={styles.exampleBlock}>{children}</ClearFix>
</Paper>
);
},
});
}
}

export default CodeExample;
10 changes: 4 additions & 6 deletions docs/src/app/components/pages/customization/inline-styles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import CodeExample from '../../CodeExample';
const {Typography} = Styles;


const InlineStyles = React.createClass({

class InlineStyles extends React.Component {
getStyles() {
return {
headline: {
Expand All @@ -28,7 +27,7 @@ const InlineStyles = React.createClass({
color: Typography.textDarkBlack,
},
};
},
}

render() {
let codeOverrideStyles =
Expand Down Expand Up @@ -125,8 +124,7 @@ const InlineStyles = React.createClass({
</p>
</div>
);
},

});
}
}

export default InlineStyles;
20 changes: 8 additions & 12 deletions src/date-picker/date-picker-inline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ const styles = {
},
};

const DatePickerInline = React.createClass({

propTypes: {
class DatePickerInline extends React.Component {
static propTypes = {
actions: React.PropTypes.node,
children: React.PropTypes.node,
open: React.PropTypes.bool,
Expand All @@ -30,13 +29,11 @@ const DatePickerInline = React.createClass({
* Override the inline-styles of the root element.
*/
style: React.PropTypes.object,
},
};

getDefaultProps() {
return {
open: false,
};
},
static defaultProps = {
open: false,
};

render() {
const {
Expand All @@ -63,8 +60,7 @@ const DatePickerInline = React.createClass({
</div>
</div>
);
},

});
}
}

export default DatePickerInline;
23 changes: 9 additions & 14 deletions src/lists/nested-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import React from 'react';
import {mergeStyles} from '../utils/styles';
import List from './list';


const NestedList = React.createClass({

propTypes: {
class NestedList extends React.Component {
static propTypes = {
children: React.PropTypes.node,
nestedLevel: React.PropTypes.number,
open: React.PropTypes.bool,
Expand All @@ -14,14 +12,12 @@ const NestedList = React.createClass({
* Override the inline-styles of the root element.
*/
style: React.PropTypes.object,
},
};

getDefaultProps() {
return {
nestedLevel: 1,
open: false,
};
},
static defaultProps = {
nestedLevel: 1,
open: false,
};

render() {

Expand Down Expand Up @@ -51,8 +47,7 @@ const NestedList = React.createClass({
}
</List>
);
},

});
}
}

export default NestedList;
10 changes: 5 additions & 5 deletions src/tabs/tabTemplate.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';

const TabTemplate = React.createClass({
propTypes: {
class TabTemplate extends React.Component {
static propTypes = {
children: React.PropTypes.node,
selected: React.PropTypes.bool,
},
};

render() {
const styles = {
Expand All @@ -25,7 +25,7 @@ const TabTemplate = React.createClass({
{this.props.children}
</div>
);
},
});
}
}

export default TabTemplate;

0 comments on commit e12a66c

Please sign in to comment.