Merged
Conversation
e359da7 to
31a1a16
Compare
8971cf5 to
b55b770
Compare
90c256e to
b55b770
Compare
Contributor
Author
|
Working on it @oliviertassinari . |
Member
|
@shaurya947 I can see this :p. You don't need to close the PR. A |
Contributor
Author
|
@oliviertassinari I ran into some issues initially and I ranted about those on SO. Due to the process I had to follow (which was essentially a rebase but involved merging my Still getting used to troubleshooting git issues ^_^ |
Contributor
Author
|
@oliviertassinari should be good now. |
Member
|
@shaurya947 Nice 👍 |
added 8 commits
September 22, 2015 17:12
Raw Theme is made up of spacing, palette, and font family, whereas MUI theme is made of key:value pairs, each of which represents the styling of a material-ui component based on the given raw theme. In addition, the MUI theme also contains a reference to the raw theme from which it was produced. In every material-ui component, the "state" is used for the theme, and theme is passed down using context. Within the component, theme is always accessed using state. When a component is first mounted, we check whether a theme object is passed down using context in the getInitialState() method. If one is not found, we initialize a default MUI theme based on the default (light) raw theme. Moreover, to listen for updates when the parent changes the theme, the new context is always checked in componentWillReceiveProps(). Now, the ThemeManager module simply contains functions that return new MUI theme objects (support for immutability). The theme itself (raw theme) is a plain JS object containing key:value pairs for spacing, palette, and font family. Users can easily define their own raw themes and require() them in their modules.
Simplified theme wrapper component to be used as another way to pass down theme. Currently, there are some issues regarding owner-based vs parent-based contexts when using the theme wrapper. Hopefully, these will go away with React 0.14
Fixed unit tests to use new theming code.
Modified primary1Color of dark-raw-theme to Colors.grey500
60d4c14 to
438f6b2
Compare
Now, `textTransform` can be applied to all buttons (both `FlatButton` and `RaisedButton`), only `FlatButton`, or only `RaisedButton` on a theme-level. Here is how: ```js let newMuiTheme = ThemeManager.getMuiTheme(LightRawTheme); //override theme variable for button //this override will apply to both FlatButton and RaisedButton newMuiTheme.button.textTransform = 'none'; ``` ```js let newMuiTheme = ThemeManager.getMuiTheme(LightRawTheme); //override theme variable for only RaisedButton or FlatButton (substitute accordingly) newMuiTheme.raisedButton.textTransform = 'none'; ``` `textTransform` corresponds to the CSS `text-transform` property and can take any valid value that the CSS property can take. Related to mui#1576
This was referenced Sep 23, 2015
Merged
This was referenced Sep 24, 2015
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-doing themes for version 0.12:
spacing,paletteandfontFamily. The material-ui theme is a much bigger object, and is produced based on the raw theme. It contains a key for every material-ui component, and the corresponding value describes how that component is going to look under that particular theme. The material-ui theme also contains a reference to the raw theme object from which it was produced.ThemeManagermodule has been modified. Now, it contains only the following functions that return a material-ui (mui) theme object:getMuiTheme (rawTheme): this function takes in a raw theme object and returns the mui theme produced from it.modifyRawThemeSpacing (muiTheme, newSpacing),modifyRawThemePalette (muiTheme, newPaletteKeys)andmodifyRawThemeFontFamily (muiTheme, newFontFamily): these three functions are provided as modifiers for the raw theme. They take in the current mui theme object and the new information to be updated, and return a new, re-computed mui theme object. Providing these modifiers separately is an effort to keep the mui theme object immutable throughout the application.this.state.muiTheme. Reset the theme usingthis.setState(). This is consistent with the immutability approach as react components re-render whenever the state changes.lib/styles/raw-themes. Custom raw themes may be defined in a similar manner.getInitialState(): the context is checked for a theme object here. If no theme is found, a default theme is applied.contextTypes: to indicate that anmuiThemeobject is expected from the parent.childContextTypes: to indicate that anmuiThemeobject will be passed down to children.getChildContext(): to pass down themuiThemeobject to the children.componentWillReceiveProps(nextProps, nextContext): every time a new theme is passed down through the context, this method updates the state of the component with the new theme.ThemeDecoratormodule can be used to decorate (ES7-style decorators) the app component. These are the two ways that we recommend that you go about theming for now.classkeyword that extendsReact.Component(as opposed to usingReact.createClass).