Skip to content

Instantly share code, notes, and snippets.

@JimmyLv
Last active May 19, 2017 02:36
Show Gist options
  • Select an option

  • Save JimmyLv/95c3c3794d02efcce6ca5b11d5578b55 to your computer and use it in GitHub Desktop.

Select an option

Save JimmyLv/95c3c3794d02efcce6ca5b11d5578b55 to your computer and use it in GitHub Desktop.
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)
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>
@JimmyLv

JimmyLv commented May 19, 2017

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment