Skip to content

Commit

Permalink
[Refactor] Renames context variable theme to muiTheme. See
Browse files Browse the repository at this point in the history
@JedWatson's comment on mui#30.
  • Loading branch information
mmrtnz committed May 1, 2015
1 parent 1348d0a commit d4c40af
Show file tree
Hide file tree
Showing 44 changed files with 137 additions and 137 deletions.
4 changes: 2 additions & 2 deletions docs/src/app/components/code-example/code-example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var React = require('react'),
class CodeExample extends React.Component {

render() {
var borderColor = this.context.theme.palette.borderColor;
var borderColor = this.context.muiTheme.palette.borderColor;
var style = {
label: {
color: borderColor
Expand All @@ -33,7 +33,7 @@ CodeExample.propTypes = {
};

CodeExample.contextTypes = {
theme: React.PropTypes.object
muiTheme: React.PropTypes.object
}

module.exports = CodeExample;
4 changes: 2 additions & 2 deletions docs/src/app/components/master.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Master extends React.Component {

getChildContext() {
return {
theme: ThemeManager.getCurrentTheme()
muiTheme: ThemeManager.getCurrentTheme()
}
}

Expand Down Expand Up @@ -71,7 +71,7 @@ Master.contextTypes = {
};

Master.childContextTypes = {
theme: React.PropTypes.object
muiTheme: React.PropTypes.object
};

module.exports = Master;
6 changes: 3 additions & 3 deletions docs/src/app/components/pages/components/menus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class MenusPage extends React.Component {

getChildContext() {
return {
theme: ThemeManager.getCurrentTheme()
muiTheme: ThemeManager.getCurrentTheme()
};
}

Expand Down Expand Up @@ -366,11 +366,11 @@ class MenusPage extends React.Component {
}

MenusPage.contextTypes = {
theme: React.PropTypes.object
muiTheme: React.PropTypes.object
};

MenusPage.childContextTypes = {
theme: React.PropTypes.object
muiTheme: React.PropTypes.object
};

module.exports = MenusPage;
18 changes: 9 additions & 9 deletions docs/src/app/components/pages/customization/themes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ThemesPage extends React.Component {

getChildContext() {
return {
theme: ThemeManager.getCurrentTheme()
muiTheme: ThemeManager.getCurrentTheme()
}
}

Expand All @@ -56,13 +56,13 @@ class ThemesPage extends React.Component {
' // Important!\n' +
' getChildContext() { \n' +
' return {\n' +
' theme: ThemeManager.getCurrentTheme()\n' +
' muiTheme: ThemeManager.getCurrentTheme()\n' +
' };\n' +
' }\n' +
'};\n\n' +
'// Important!\n' +
'OuterMostParentComponent.childContextTypes = {\n' +
' theme: React.PropTypes.object\n' +
' muiTheme: React.PropTypes.object\n' +
'};\n\n' +
'module.exports = OuterMostParentComponent;';

Expand All @@ -73,20 +73,20 @@ class ThemesPage extends React.Component {
'var OuterMostParentComponent = React.createClass ({\n' +
' // Important!\n' +
' childContextTypes: {\n' +
' theme: React.PropTypes.object\n' +
' muiTheme: React.PropTypes.object\n' +
' },\n\n' +
' // Important!\n' +
' getChildContext: function() { \n' +
' return {\n' +
' theme: ThemeManager.getCurrentTheme()\n' +
' muiTheme: ThemeManager.getCurrentTheme()\n' +
' };\n' +
' }\n' +
'});\n\n' +
'module.exports = OuterMostParentComponent;';

var customComponentCode =
'CustomReactComponent.contextTypes = {\n' +
' theme: React.PropTypes.object\n' +
' muiTheme: React.PropTypes.object\n' +
'}';

var desc = 'ThemeManager allows you to manipulate the current theme of your website. Themes are ' +
Expand Down Expand Up @@ -614,7 +614,7 @@ class ThemesPage extends React.Component {
'class MenusPage extends React.Component {\n\n' +
' getChildContext() { \n' +
' return {\n' +
' theme: ThemeManager.getCurrentTheme()\n' +
' muiTheme: ThemeManager.getCurrentTheme()\n' +
' }\n' +
' }\n\n' +
' componentWillMount() {\n' +
Expand All @@ -627,7 +627,7 @@ class ThemesPage extends React.Component {
' }\n' +
'}\n\n' +
'MenusPage.childContextTypes = {\n' +
' theme: React.PropTypes.object\n' +
' muiTheme: React.PropTypes.object\n' +
'};'
);
}
Expand Down Expand Up @@ -661,7 +661,7 @@ class ThemesPage extends React.Component {
}

ThemesPage.childContextTypes = {
theme: React.PropTypes.object
muiTheme: React.PropTypes.object
};

module.exports = ThemesPage;
8 changes: 4 additions & 4 deletions src/app-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var AppBar = React.createClass({
mixins: [StylePropable],

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

propTypes: {
Expand Down Expand Up @@ -43,15 +43,15 @@ var AppBar = React.createClass({
},

getSpacing: function() {
return this.context.theme.spacing;
return this.context.muiTheme.spacing;
},

getThemeVariables: function() {
return this.context.theme.component.appBar;
return this.context.muiTheme.component.appBar;
},

getStyles: function(){
var iconButtonSize = this.context.theme.component.button.iconButtonSize;
var iconButtonSize = this.context.muiTheme.component.button.iconButtonSize;
var styles = {
root: {
zIndex: 5,
Expand Down
6 changes: 3 additions & 3 deletions src/app-canvas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var React = require('react');
var AppCanvas = React.createClass({

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

propTypes: {
Expand All @@ -14,13 +14,13 @@ var AppCanvas = React.createClass({

var styles = {
height: '100%',
backgroundColor: this.context.theme.palette.canvasColor,
backgroundColor: this.context.muiTheme.palette.canvasColor,
WebkitFontSmoothing: 'antialiased'
};

var stylesAppBar = {
position: 'fixed',
height: this.context.theme.component.appBar.height
height: this.context.muiTheme.component.appBar.height
};

var newChildren = React.Children.map(this.props.children, function(currentChild) {
Expand Down
4 changes: 2 additions & 2 deletions src/checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var Checkbox = React.createClass({
mixins: [StylePropable],

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

propTypes: {
Expand All @@ -29,7 +29,7 @@ var Checkbox = React.createClass({
},

getTheme: function() {
return this.context.theme.component.checkbox;
return this.context.muiTheme.component.checkbox;
},

getStyles: function() {
Expand Down
4 changes: 2 additions & 2 deletions src/date-picker/date-display.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var DateDisplay = React.createClass({
mixins: [StylePropable],

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

propTypes: {
Expand Down Expand Up @@ -42,7 +42,7 @@ var DateDisplay = React.createClass({
},

getTheme: function() {
return this.context.theme.component.datePicker;
return this.context.muiTheme.component.datePicker;
},

render: function() {
Expand Down
4 changes: 2 additions & 2 deletions src/date-picker/date-picker-dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var DatePickerDialog = React.createClass({
mixins: [StylePropable, WindowListenable],

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

propTypes: {
Expand Down Expand Up @@ -44,7 +44,7 @@ var DatePickerDialog = React.createClass({
var styles = {
root: {
fontSize: '14px',
color: this.context.theme.component.datePicker.calendarTextColor
color: this.context.muiTheme.component.datePicker.calendarTextColor
},

dialogContents: {
Expand Down
6 changes: 3 additions & 3 deletions src/date-picker/day-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var DayButton = React.createClass({
mixins: [StylePropable],

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

propTypes: {
Expand All @@ -19,7 +19,7 @@ var DayButton = React.createClass({
},

getTheme: function() {
return this.context.theme.component.datePicker;
return this.context.muiTheme.component.datePicker;
},

render: function() {
Expand All @@ -43,7 +43,7 @@ var DayButton = React.createClass({

label: {
position: 'relative',
color: this.context.theme.palette.textColor
color: this.context.muiTheme.palette.textColor
},

select: {
Expand Down
6 changes: 3 additions & 3 deletions src/dialog-window.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var DialogWindow = React.createClass({
mixins: [WindowListenable, StylePropable],

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

propTypes: {
Expand Down Expand Up @@ -62,11 +62,11 @@ var DialogWindow = React.createClass({
},

getTheme: function() {
return this.context.theme;
return this.context.muiTheme;
},

getSpacing: function() {
return this.context.theme.spacing;
return this.context.muiTheme.spacing;
},

getStyles: function() {
Expand Down
4 changes: 2 additions & 2 deletions src/dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var Dialog = React.createClass({
mixins: [StylePropable],

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

propTypes: {
Expand All @@ -20,7 +20,7 @@ var Dialog = React.createClass({
var styles = {
title: {
padding: gutter + gutter + '0 ' + gutter,
color: this.context.theme.palette.textColor
color: this.context.muiTheme.palette.textColor
},
content: {
padding: Spacing.desktopGutter
Expand Down
12 changes: 6 additions & 6 deletions src/drop-down-menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var DropDownMenu = React.createClass({
mixins: [StylePropable, ClickAwayable],

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

// The nested styles for drop-down-menu are modified by toolbar and possibly
Expand Down Expand Up @@ -57,16 +57,16 @@ var DropDownMenu = React.createClass({
},

getSpacing: function() {
return this.context.theme.spacing;
return this.context.muiTheme.spacing;
},

getTextColor: function() {
return this.context.theme.palette.textColor;
return this.context.muiTheme.palette.textColor;
},

getStyles: function(){
var accentColor = this.context.theme.component.dropDownMenu.accentColor;
var backgroundColor = this.context.theme.component.menu.backgroundColor;
var accentColor = this.context.muiTheme.component.dropDownMenu.accentColor;
var backgroundColor = this.context.muiTheme.component.menu.backgroundColor;
var styles = {
root: {
transition: Transitions.easeOut(),
Expand All @@ -92,7 +92,7 @@ var DropDownMenu = React.createClass({
position: 'absolute',
top: ((this.getSpacing().desktopToolbarHeight - 24) / 2),
right: this.getSpacing().desktopGutterLess,
fill: this.context.theme.component.dropDownMenu.accentColor
fill: this.context.muiTheme.component.dropDownMenu.accentColor
},
label: {
transition: Transitions.easeOut(),
Expand Down
4 changes: 2 additions & 2 deletions src/enhanced-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var EnhancedButton = React.createClass({
mixins: [StylePropable, WindowListenable],

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

propTypes: {
Expand Down Expand Up @@ -64,7 +64,7 @@ var EnhancedButton = React.createClass({
background: 'none',
boxSizing: 'border-box',
font: 'inherit',
fontFamily: this.context.theme.contentFontFamily,
fontFamily: this.context.muiTheme.contentFontFamily,
WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
WebkitApperance: 'button',
cursor: 'pointer'
Expand Down
4 changes: 2 additions & 2 deletions src/enhanced-switch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var EnhancedSwitch = React.createClass({
mixins: [WindowListenable, StylePropable],

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

propTypes: {
Expand Down Expand Up @@ -96,7 +96,7 @@ var EnhancedSwitch = React.createClass({
},

getTheme: function() {
return this.context.theme.palette;
return this.context.muiTheme.palette;
},

getStyles: function() {
Expand Down
Loading

0 comments on commit d4c40af

Please sign in to comment.