Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Major Theme Handling Migration #2585

Closed
wants to merge 70 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
c2ab8e5
Map raw-themes to base-themes
mbrookes Dec 15, 2015
aeefc97
add lodash.merge as a required dependency
alitaheri Dec 18, 2015
1d58e3a
major improvement to theme handling
alitaheri Dec 18, 2015
5d822a2
migrate divider to use the new theme standard
alitaheri Dec 18, 2015
e749b29
migrate dialog to use the new theme standard
alitaheri Dec 18, 2015
e7302dd
migrate DropDownMenu to use the new theme standard
alitaheri Dec 19, 2015
79dd0b5
partially migrate docs to adhere to the new naming strategy
alitaheri Dec 19, 2015
a50b881
rename muiTheme to _muiTheme in TextFieldUnderline.jsx
alitaheri Dec 19, 2015
96a1bb6
add _muiTheme as a required prop globally
alitaheri Dec 19, 2015
4b8b38d
patch theme-wrapper to work with new naming convention
alitaheri Dec 19, 2015
77f030d
eslint fixes
alitaheri Dec 19, 2015
346cff1
migrate TextField to use the new theme handling
alitaheri Dec 19, 2015
713d031
migrate menu to use the new theme handling
alitaheri Dec 19, 2015
67aac58
remove theme from before-after-wrapper
alitaheri Dec 19, 2015
b9ca804
eslint fixes
alitaheri Dec 19, 2015
f8c03fd
patch up the old menus
alitaheri Dec 19, 2015
15c84ef
migrate icon-button to use the new theme handling
alitaheri Dec 19, 2015
57bf391
migrate tabs to use the new theme handling
alitaheri Dec 19, 2015
91a4f16
migrate enhanced-button to use the new theme handling
alitaheri Dec 19, 2015
e9d5dc6
patch style-propable to consider props and _muiTheme on state
alitaheri Dec 19, 2015
b4fecb3
migrate paper to use the new theme handling
alitaheri Dec 19, 2015
513dfbf
migrate app-canvas to use the new theme handling
alitaheri Dec 19, 2015
bf22ccb
migrate icons to use the new theme handling
alitaheri Dec 19, 2015
2bfe05b
migrate ink-bar to use the new theme handling
alitaheri Dec 19, 2015
095af3c
migrate before-after-wrapper to use the new theme handling
alitaheri Dec 19, 2015
b529453
migrate card to use the new theme handling
alitaheri Dec 20, 2015
bb26e98
migrate flat button and text area to use the new theme handling
alitaheri Dec 20, 2015
0215388
migrate date-picker
alitaheri Dec 20, 2015
58d2633
migrate CircularProgress
alitaheri Dec 20, 2015
9bfa721
migrate Checkbox
alitaheri Dec 20, 2015
92db8d0
migrate Badge
alitaheri Dec 20, 2015
17cbd77
migrate avatar
alitaheri Dec 20, 2015
bb1380d
migrate auto-complete
alitaheri Dec 20, 2015
a97f689
migrate appbar
alitaheri Dec 20, 2015
c53a0ec
migrated SelectableContainerEnhance
alitaheri Dec 20, 2015
3d5881e
migrated grid list
alitaheri Dec 20, 2015
e0a2f1b
migrated overlay
alitaheri Dec 20, 2015
185c1df
migrated left-nav
alitaheri Dec 20, 2015
f4eb1d4
migrated FAB
alitaheri Dec 20, 2015
1f662c7
migrated EnhancedSwitch
alitaheri Dec 20, 2015
7e48fbb
patch drop down icon
alitaheri Dec 20, 2015
8cb134e
migrate list
alitaheri Dec 20, 2015
daef770
migrate linear-progress
alitaheri Dec 20, 2015
6c6371f
migrate popover
alitaheri Dec 20, 2015
b29842b
migrate transition groups
alitaheri Dec 20, 2015
c25cc3b
migrate render-to-layer
alitaheri Dec 20, 2015
8b7eaea
migrate tooltip
alitaheri Dec 20, 2015
13cf40f
migrate switches
alitaheri Dec 20, 2015
18a9c08
migrate raised-button
alitaheri Dec 20, 2015
a40b383
migrate refresh indicator
alitaheri Dec 20, 2015
f4cf2ea
migrate select field
alitaheri Dec 20, 2015
8a0f683
migrate slider
alitaheri Dec 20, 2015
33583d3
migrate snackbar
alitaheri Dec 20, 2015
cca367a
migrate toolbar
alitaheri Dec 20, 2015
3075889
migrate table
alitaheri Dec 20, 2015
6dd4bee
migrate time picker
alitaheri Dec 20, 2015
61c5889
migrate doc components
alitaheri Dec 20, 2015
5e98afb
bug fixes
alitaheri Dec 20, 2015
62bfead
forward imperative methods
alitaheri Dec 20, 2015
f42ad17
fixed regressions caused by migration
alitaheri Dec 20, 2015
b8a4bdc
function wrapper should also forward the return value
alitaheri Dec 20, 2015
211162f
forward some methods.
alitaheri Dec 20, 2015
c1485f2
export base themes
alitaheri Dec 21, 2015
73b306b
improve muiThemeable
alitaheri Dec 21, 2015
8a48ccf
lazily evaluate the default theme
alitaheri Dec 21, 2015
9f51537
forward imperative methods throughout the library
alitaheri Dec 21, 2015
d9335a8
bug fixes
alitaheri Dec 21, 2015
1bdfe0d
have customization/themes use MuiThemeProvider
alitaheri Dec 21, 2015
2e5156d
patch tests
alitaheri Dec 21, 2015
5a0ed1e
fix eslint errors
alitaheri Dec 21, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
migrate icon-button to use the new theme handling
alitaheri committed Dec 21, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 15c84ef1cbe46c7ffeec9e5190accb43aaa74a63
36 changes: 7 additions & 29 deletions src/icon-button.jsx
Original file line number Diff line number Diff line change
@@ -7,24 +7,19 @@ import EnhancedButton from './enhanced-button';
import FontIcon from './font-icon';
import Tooltip from './tooltip';
import Children from './utils/children';
import DefaultRawTheme from './styles/raw-themes/light-raw-theme';
import ThemeManager from './styles/theme-manager';
import muiThemeable from './muiThemeable';

const IconButton = React.createClass({
let IconButton = React.createClass({

mixins: [
StylePropable,
ContextPure,
],

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

statics: {
getRelevantContextKeys(muiTheme) {
const spacing = muiTheme.rawTheme.spacing;
const palette = muiTheme.rawTheme.palette;
const spacing = muiTheme.baseTheme.spacing;
const palette = muiTheme.baseTheme.palette;

return {
iconSize: spacing.iconSize,
@@ -42,17 +37,6 @@ const IconButton = React.createClass({
},
},

//for passing default theme context to children
childContextTypes: {
muiTheme: React.PropTypes.object,
},

getChildContext() {
return {
muiTheme: this.state.muiTheme,
};
},

propTypes: {
/**
* The MUI Theme to use to render this component with.
@@ -87,17 +71,9 @@ const IconButton = React.createClass({
getInitialState() {
return {
tooltipShown: false,
muiTheme: this.context.muiTheme ? this.context.muiTheme : ThemeManager.getMuiTheme(DefaultRawTheme),
};
},

//to update theme inside state whenever a new theme is passed down
//from the parent / owner using context
componentWillReceiveProps(nextProps, nextContext) {
let newMuiTheme = nextContext.muiTheme ? nextContext.muiTheme : this.state.muiTheme;
this.setState({muiTheme: newMuiTheme});
},

getDefaultProps() {
return {
iconStyle: {},
@@ -110,7 +86,7 @@ const IconButton = React.createClass({
iconSize,
textColor,
disabledColor,
} = this.constructor.getRelevantContextKeys(this.state.muiTheme);
} = this.constructor.getRelevantContextKeys(this.props._muiTheme);

let styles = {
root: {
@@ -262,4 +238,6 @@ const IconButton = React.createClass({

});

IconButton = muiThemeable(IconButton);

export default IconButton;