Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4597255
commit 59ace82
Showing
5 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
import styled from 'styled-components'; | ||
|
||
const Container = styled.div` | ||
textAlign: center; | ||
`; | ||
|
||
const Button = styled.button` | ||
backgroundColor: #ff0000; | ||
width: 320px; | ||
padding: 20px; | ||
borderRadius: 5px; | ||
border: none; | ||
outline: none; | ||
&:hover { | ||
color: #fff; | ||
} | ||
&:active { | ||
position: relative; | ||
top: 2px; | ||
} | ||
@media (max-width: 480px) { | ||
width: 160px; | ||
} | ||
`; | ||
|
||
const App = () => ( | ||
<Container> | ||
<Button>Click me!</Button> | ||
</Container> | ||
); | ||
|
||
render(<App />, document.getElementById('content')); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>styled-components - CSS in JS</title> | ||
</head> | ||
<body> | ||
<div id="content"></div> | ||
<script src="bundle.js"></script> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "styled-components-css-in-js", | ||
"version": "1.0.0", | ||
"description": "styled-components - CSS in JS", | ||
"scripts": { | ||
"build": "webpack ./button.js bundle.js" | ||
}, | ||
"author": "Michele Bertoli", | ||
"license": "MIT", | ||
"dependencies": { | ||
"react": "^15.3.0", | ||
"react-dom": "^15.3.0", | ||
"styled-components": "^1.0.3" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.11.4", | ||
"babel-loader": "^6.2.4", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-react": "^6.11.1", | ||
"webpack": "^1.13.1" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
module: { | ||
loaders: [{ | ||
test: /\.js$/, | ||
exclude: /(node_modules|bower_components)/, | ||
loader: 'babel', | ||
query: { | ||
presets: ['es2015', 'react'] | ||
} | ||
}] | ||
} | ||
} |