Last active
May 19, 2017 02:36
-
-
Save JimmyLv/95c3c3794d02efcce6ca5b11d5578b55 to your computer and use it in GitHub Desktop.
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
| import Radium, { StyleRoot } from 'radium'; | |
| import breakpoints from '../../../styles/breakpoints'; | |
| const styles = { | |
| header: { | |
| fontSize: '1.5em', | |
| display: 'inline', | |
| [`@media screen and (min-width: ${breakpoints.screenMedium})`]: { | |
| paddingTop: '2%'; | |
| }, | |
| }, | |
| content1: { | |
| textAlign: 'center', | |
| color: 'palevioletred' | |
| }, | |
| content2: { | |
| textAlign: 'right', | |
| color: 'red' | |
| } | |
| }; | |
| const Header = () => <StyleRoot> | |
| <div style={[styles.header, this.state.flag ? styles.content1 : styles.content2]} className="sg-Header">Hello World!</div> | |
| </StyleRoot> | |
| export default Radium(Header) |
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
| import styled from 'styled-components'; | |
| import breakpoints from '../../../styles/breakpoints'; | |
| const Header = styled.div` | |
| font-size: 1.5em; | |
| text-align: ${props => props.content ? 'center' : 'right'}; | |
| color: ${props => props.content ? 'palevioletred' : 'red'}; | |
| @media all and (max-width: ${breakpoints.screenMedium}) { | |
| padding-top: 2%; | |
| } | |
| `; | |
| export default () => <Header content={this.state.flag} className="sg-Header">Hello World!</Header> | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
坑:
http://martinbrochhaus.com/react-styles-issue.html