Created
August 5, 2017 22:48
-
-
Save 1dolinski/d05c09edf23a610a8a8b6a1da37eeeb9 to your computer and use it in GitHub Desktop.
styletron
This file contains 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 React, { Component } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import {styled} from 'styletron-react'; | |
const Panel = styled('div', { | |
backgroundColor: 'lightblue', | |
fontSize: '12px', | |
'@media (max-width: 768px)': { | |
fontSize: '24px' | |
}, | |
}); | |
const Next = styled('div', (props) => ({ | |
backgroundColor: props.color ? props.color : 'red', | |
})) | |
class App extends Component { | |
render() { | |
return ( | |
<div className="App"> | |
<Panel>Hello World</Panel> | |
<Next>Hey</Next> | |
<Next color={"green"}>OK</Next> | |
<div className="App-header"> | |
<img src={logo} className="App-logo" alt="logo" /> | |
<h2>Welcome to React</h2> | |
</div> | |
<p className="App-intro"> | |
To get started, edit <code>src/App.js</code> and save to reload. | |
</p> | |
</div> | |
); | |
} | |
} | |
export default App; |
This file contains 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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import App from './App'; | |
import registerServiceWorker from './registerServiceWorker'; | |
import Styletron from 'styletron-client'; | |
import {StyletronProvider} from 'styletron-react'; | |
ReactDOM.render( | |
<StyletronProvider styletron={new Styletron()}> | |
<App/> | |
</StyletronProvider>, | |
document.getElementById('root') | |
); | |
registerServiceWorker(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment