Skip to content

Commit

Permalink
Merge pull request mui#4058 from mbrookes/named-imports
Browse files Browse the repository at this point in the history
[Core] Used named imports for createClass, Component & PropTypes
  • Loading branch information
oliviertassinari committed Apr 22, 2016
2 parents 051fbc2 + a76c088 commit 88fb46d
Show file tree
Hide file tree
Showing 129 changed files with 1,385 additions and 1,385 deletions.
20 changes: 10 additions & 10 deletions docs/src/app/components/AppNavDrawer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import Drawer from 'material-ui/Drawer';
import {List, ListItem, MakeSelectable} from 'material-ui/List';
import Divider from 'material-ui/Divider';
Expand All @@ -10,20 +10,20 @@ import {cyan500} from 'material-ui/styles/colors';

const SelectableList = MakeSelectable(List);

const AppNavDrawer = React.createClass({
const AppNavDrawer = createClass({

propTypes: {
docked: React.PropTypes.bool.isRequired,
location: React.PropTypes.object.isRequired,
onChangeList: React.PropTypes.func.isRequired,
onRequestChangeNavDrawer: React.PropTypes.func.isRequired,
open: React.PropTypes.bool.isRequired,
style: React.PropTypes.object,
docked: PropTypes.bool.isRequired,
location: PropTypes.object.isRequired,
onChangeList: PropTypes.func.isRequired,
onRequestChangeNavDrawer: PropTypes.func.isRequired,
open: PropTypes.bool.isRequired,
style: PropTypes.object,
},

contextTypes: {
muiTheme: React.PropTypes.object.isRequired,
router: React.PropTypes.object.isRequired,
muiTheme: PropTypes.object.isRequired,
router: PropTypes.object.isRequired,
},

getInitialState: () => {
Expand Down
10 changes: 5 additions & 5 deletions docs/src/app/components/CodeExample/CodeBlock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import MarkdownElement from '../MarkdownElement';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import transitions from 'material-ui/styles/transitions';
Expand Down Expand Up @@ -31,11 +31,11 @@ const styles = {
},
};

const CodeBlock = React.createClass({
const CodeBlock = createClass({
propTypes: {
children: React.PropTypes.string,
description: React.PropTypes.string,
title: React.PropTypes.string,
children: PropTypes.string,
description: PropTypes.string,
title: PropTypes.string,
},
mixins: [
PureRenderMixin,
Expand Down
6 changes: 3 additions & 3 deletions docs/src/app/components/CodeExample/CodeBlockTitle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {PropTypes} from 'react';
import IconButton from 'material-ui/IconButton';
import CodeIcon from 'material-ui/svg-icons/action/code';
import {Toolbar, ToolbarGroup, ToolbarTitle} from 'material-ui/Toolbar';
Expand All @@ -17,8 +17,8 @@ const CodeBlockTitle = (props) => (
);

CodeBlockTitle.propTypes = {
title: React.PropTypes.string,
tooltip: React.PropTypes.string,
title: PropTypes.string,
tooltip: PropTypes.string,
};

export default CodeBlockTitle;
18 changes: 9 additions & 9 deletions docs/src/app/components/CodeExample/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import React from 'react';
import React, {Component, PropTypes} from 'react';
import {parse} from 'react-docgen';
import CodeBlock from './CodeBlock';
import ClearFix from 'material-ui/internal/ClearFix';
import Paper from 'material-ui/Paper';

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

static defaultProps = {
component: true,
};

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

render() {
Expand Down
18 changes: 9 additions & 9 deletions docs/src/app/components/ComponentDoc.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import {ClearFix} from 'material-ui';
import ComponentInfo from './ComponentInfo';
import typography from 'styles/typography';

const ComponentDoc = React.createClass({
const ComponentDoc = createClass({

propTypes: {
children: React.PropTypes.node,
componentInfo: React.PropTypes.array.isRequired,
desc: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.element,
children: PropTypes.node,
componentInfo: PropTypes.array.isRequired,
desc: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element,
]),
name: React.PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
},

contextTypes: {
muiTheme: React.PropTypes.object,
muiTheme: PropTypes.object,
},

getStyles() {
Expand Down
12 changes: 6 additions & 6 deletions docs/src/app/components/ComponentInfo.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import {Mixins, Styles} from 'material-ui';

const {StyleResizable} = Mixins;
const {typography, spacing} = Styles;

const ComponentInfo = React.createClass({
const ComponentInfo = createClass({

propTypes: {
infoArray: React.PropTypes.array.isRequired,
name: React.PropTypes.string.isRequired,
style: React.PropTypes.object,
infoArray: PropTypes.array.isRequired,
name: PropTypes.string.isRequired,
style: PropTypes.object,
},

contextTypes: {
muiTheme: React.PropTypes.object,
muiTheme: PropTypes.object,
},

mixins: [StyleResizable],
Expand Down
14 changes: 7 additions & 7 deletions docs/src/app/components/FullWidthSection.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import ClearFix from 'material-ui/internal/ClearFix';
import spacing from 'material-ui/styles/spacing';
import styleResizable from 'material-ui/utils/styleResizable';
const desktopGutter = spacing.desktopGutter;

const FullWidthSection = React.createClass({
const FullWidthSection = createClass({

propTypes: {
children: React.PropTypes.node,
contentStyle: React.PropTypes.object,
contentType: React.PropTypes.string,
style: React.PropTypes.object,
useContent: React.PropTypes.bool,
children: PropTypes.node,
contentStyle: PropTypes.object,
contentType: PropTypes.string,
style: PropTypes.object,
useContent: PropTypes.bool,
},

mixins: [
Expand Down
8 changes: 4 additions & 4 deletions docs/src/app/components/MarkdownElement.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import marked from 'marked';
import PureRenderMixin from 'react-addons-pure-render-mixin';

Expand All @@ -12,10 +12,10 @@ const styles = {
},
};

const MarkdownElement = React.createClass({
const MarkdownElement = createClass({
propTypes: {
style: React.PropTypes.object,
text: React.PropTypes.string,
style: PropTypes.object,
text: PropTypes.string,
},
mixins: [
PureRenderMixin,
Expand Down
12 changes: 6 additions & 6 deletions docs/src/app/components/Master.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import Title from 'react-title-component';
import AppBar from 'material-ui/AppBar';
import IconButton from 'material-ui/IconButton';
Expand All @@ -17,19 +17,19 @@ const githubButton = (
/>
);

const Master = React.createClass({
const Master = createClass({

propTypes: {
children: React.PropTypes.node,
location: React.PropTypes.object,
children: PropTypes.node,
location: PropTypes.object,
},

contextTypes: {
router: React.PropTypes.object.isRequired,
router: PropTypes.object.isRequired,
},

childContextTypes: {
muiTheme: React.PropTypes.object,
muiTheme: PropTypes.object,
},

mixins: [
Expand Down
10 changes: 5 additions & 5 deletions docs/src/app/components/MobileTearSheet.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';

const MobileTearSheet = React.createClass({
const MobileTearSheet = createClass({

propTypes: {
children: React.PropTypes.node,
height: React.PropTypes.number,
children: PropTypes.node,
height: PropTypes.number,
},

contextTypes: {
muiTheme: React.PropTypes.object,
muiTheme: PropTypes.object,
},

getDefaultProps() {
Expand Down
10 changes: 5 additions & 5 deletions docs/src/app/components/PropTypeDescription.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import {parse} from 'react-docgen';
import {parse as parseDoctrine} from 'doctrine';
import PureRenderMixin from 'react-addons-pure-render-mixin';
Expand All @@ -8,7 +8,7 @@ import recast from 'recast';
require('./prop-type-description.css');

function getDeprecatedInfo(type) {
const deprecatedPropType = 'deprecated(React.PropTypes.';
const deprecatedPropType = 'deprecated(PropTypes.';

const indexStart = type.raw.indexOf(deprecatedPropType);

Expand Down Expand Up @@ -101,10 +101,10 @@ function generateDescription(required, description, type) {
return `${deprecated} ${jsDocText}${signature}`;
}

const PropTypeDescription = React.createClass({
const PropTypeDescription = createClass({
propTypes: {
code: React.PropTypes.string,
header: React.PropTypes.string,
code: PropTypes.string,
header: PropTypes.string,
},
mixins: [
PureRenderMixin,
Expand Down
6 changes: 3 additions & 3 deletions docs/src/app/components/pages/Home.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import HomeFeature from './HomeFeature';
import FullWidthSection from '../FullWidthSection';
import RaisedButton from 'material-ui/RaisedButton';
Expand All @@ -8,10 +8,10 @@ import typography from 'material-ui/styles/typography';
import lightBaseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import {cyan500, grey200, darkWhite} from 'material-ui/styles/colors';

const HomePage = React.createClass({
const HomePage = createClass({

contextTypes: {
router: React.PropTypes.object.isRequired,
router: PropTypes.object.isRequired,
},

mixins: [
Expand Down
14 changes: 7 additions & 7 deletions docs/src/app/components/pages/HomeFeature.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import {Link} from 'react-router';
import styleResizable from 'material-ui/utils/styleResizable';
import spacing from 'material-ui/styles/spacing';
Expand All @@ -7,14 +7,14 @@ import typography from 'material-ui/styles/typography';
import {grey200} from 'material-ui/styles/colors';
import Paper from 'material-ui/Paper';

const HomeFeature = React.createClass({
const HomeFeature = createClass({

propTypes: {
firstChild: React.PropTypes.bool,
heading: React.PropTypes.string,
img: React.PropTypes.string,
lastChild: React.PropTypes.bool,
route: React.PropTypes.string,
firstChild: PropTypes.bool,
heading: PropTypes.string,
img: PropTypes.string,
lastChild: PropTypes.bool,
route: PropTypes.string,
},

mixins: [styleResizable],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {Component, PropTypes} from 'react';
import MobileTearSheet from '../../../MobileTearSheet';
import {List, ListItem, MakeSelectable} from 'material-ui/List';
import Avatar from 'material-ui/Avatar';
Expand All @@ -7,10 +7,10 @@ import Subheader from 'material-ui/Subheader';
let SelectableList = MakeSelectable(List);

function wrapState(ComposedComponent) {
return class SelectableList extends React.Component {
return class SelectableList extends Component {
static propTypes = {
children: React.PropTypes.node.isRequired,
defaultValue: React.PropTypes.number.isRequired,
children: PropTypes.node.isRequired,
defaultValue: PropTypes.number.isRequired,
};

componentWillMount() {
Expand Down
4 changes: 2 additions & 2 deletions docs/src/app/components/pages/customization/Colors.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import React, {createClass} from 'react';
import Title from 'react-title-component';
import styleResizable from 'material-ui/utils/styleResizable';
import ClearFix from 'material-ui/internal/ClearFix';
import {getContrastRatio} from 'material-ui/utils/colorManipulator';
import typography from 'material-ui/styles/typography';
import * as colors from 'material-ui/styles/colors';

const ColorsPage = React.createClass({
const ColorsPage = createClass({

mixins: [
styleResizable,
Expand Down
8 changes: 4 additions & 4 deletions docs/src/app/components/pages/customization/Themes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {createClass, PropTypes} from 'react';
import Title from 'react-title-component';
import MarkdownElement from '../../MarkdownElement';
import muiThemeable from 'material-ui/styles/muiThemeable';
Expand Down Expand Up @@ -39,11 +39,11 @@ You can use the tabs to change the theme. The changes will be applied to the who
documentation.
`;

const ThemesPage = React.createClass({
const ThemesPage = createClass({

propTypes: {
muiTheme: React.PropTypes.object,
onChangeMuiTheme: React.PropTypes.func,
muiTheme: PropTypes.object,
onChangeMuiTheme: PropTypes.func,
},

mixins: [styleResizable],
Expand Down
Loading

0 comments on commit 88fb46d

Please sign in to comment.