From cbad9cf093ec03e60bb83f11cb98e025d6d7ab90 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Fri, 29 Jan 2016 10:41:42 +0100 Subject: [PATCH] [ES6] Apply jscodeshift to use classes --- docs/src/app/components/CodeExample/index.jsx | 15 ++++++------ .../pages/customization/inline-styles.jsx | 10 ++++---- src/date-picker/date-picker-inline.jsx | 20 +++++++--------- src/lists/nested-list.jsx | 23 ++++++++----------- src/tabs/tabTemplate.jsx | 10 ++++---- 5 files changed, 33 insertions(+), 45 deletions(-) diff --git a/docs/src/app/components/CodeExample/index.jsx b/docs/src/app/components/CodeExample/index.jsx index 4fb957cbc4950b..3fe8dc90a52e56 100644 --- a/docs/src/app/components/CodeExample/index.jsx +++ b/docs/src/app/components/CodeExample/index.jsx @@ -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() { @@ -48,7 +47,7 @@ const CodeExample = React.createClass({ {children} ); - }, -}); + } +} export default CodeExample; diff --git a/docs/src/app/components/pages/customization/inline-styles.jsx b/docs/src/app/components/pages/customization/inline-styles.jsx index c3b2a230bc08d0..13a74734332fe6 100644 --- a/docs/src/app/components/pages/customization/inline-styles.jsx +++ b/docs/src/app/components/pages/customization/inline-styles.jsx @@ -5,8 +5,7 @@ import CodeExample from '../../CodeExample'; const {Typography} = Styles; -const InlineStyles = React.createClass({ - +class InlineStyles extends React.Component { getStyles() { return { headline: { @@ -28,7 +27,7 @@ const InlineStyles = React.createClass({ color: Typography.textDarkBlack, }, }; - }, + } render() { let codeOverrideStyles = @@ -125,8 +124,7 @@ const InlineStyles = React.createClass({

); - }, - -}); + } +} export default InlineStyles; diff --git a/src/date-picker/date-picker-inline.jsx b/src/date-picker/date-picker-inline.jsx index a38c8c0fab5d63..493ae6ad1c0c10 100644 --- a/src/date-picker/date-picker-inline.jsx +++ b/src/date-picker/date-picker-inline.jsx @@ -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, @@ -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 { @@ -63,8 +60,7 @@ const DatePickerInline = React.createClass({ ); - }, - -}); + } +} export default DatePickerInline; diff --git a/src/lists/nested-list.jsx b/src/lists/nested-list.jsx index 964a75ef2d5b73..0d4388a5d2b651 100644 --- a/src/lists/nested-list.jsx +++ b/src/lists/nested-list.jsx @@ -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, @@ -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() { @@ -51,8 +47,7 @@ const NestedList = React.createClass({ } ); - }, - -}); + } +} export default NestedList; diff --git a/src/tabs/tabTemplate.jsx b/src/tabs/tabTemplate.jsx index f1039cdc83af0c..2d71962efef75b 100644 --- a/src/tabs/tabTemplate.jsx +++ b/src/tabs/tabTemplate.jsx @@ -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 = { @@ -25,7 +25,7 @@ const TabTemplate = React.createClass({ {this.props.children} ); - }, -}); + } +} export default TabTemplate;