Skip to content

Commit 62bc276

Browse files
committed
Introdução ao vue-styled-components no Vue.js
0 parents  commit 62bc276

File tree

13 files changed

+8680
-0
lines changed

13 files changed

+8680
-0
lines changed

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
# local env files
6+
.env.local
7+
.env.*.local
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Editor directories and files
15+
.idea
16+
.vscode
17+
*.suo
18+
*.ntvs*
19+
*.njsproj
20+
*.sln
21+
*.sw?

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# styled
2+
3+
## Project setup
4+
```
5+
yarn install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
yarn run serve
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
yarn run build
16+
```
17+
18+
### Run your tests
19+
```
20+
yarn run test
21+
```
22+
23+
### Lints and fixes files
24+
```
25+
yarn run lint
26+
```
27+
28+
### Customize configuration
29+
See [Configuration Reference](https://cli.vuejs.org/config/).

babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/app'
4+
]
5+
}

package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "styled",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"lint": "vue-cli-service lint"
9+
},
10+
"dependencies": {
11+
"core-js": "^2.6.5",
12+
"vue": "^2.6.10",
13+
"vue-styled-components": "^1.4.9"
14+
},
15+
"devDependencies": {
16+
"@vue/cli-plugin-babel": "^3.11.0",
17+
"@vue/cli-plugin-eslint": "^3.11.0",
18+
"@vue/cli-service": "^3.11.0",
19+
"babel-eslint": "^10.0.1",
20+
"eslint": "^5.16.0",
21+
"eslint-plugin-vue": "^5.0.0",
22+
"vue-template-compiler": "^2.6.10"
23+
},
24+
"eslintConfig": {
25+
"root": true,
26+
"env": {
27+
"node": true
28+
},
29+
"extends": [
30+
"plugin:vue/essential",
31+
"eslint:recommended"
32+
],
33+
"rules": {},
34+
"parserOptions": {
35+
"parser": "babel-eslint"
36+
}
37+
},
38+
"postcss": {
39+
"plugins": {
40+
"autoprefixer": {}
41+
}
42+
},
43+
"browserslist": [
44+
"> 1%",
45+
"last 2 versions"
46+
]
47+
}

public/favicon.ico

4.19 KB
Binary file not shown.

public/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title>styled</title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but styled doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+
</noscript>
14+
<div id="app"></div>
15+
<!-- built files will be auto injected -->
16+
</body>
17+
</html>

src/App.vue

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<div id="app">
3+
<img alt="Vue logo" src="./assets/logo.png">
4+
<h1>Styled Components no Vue.js</h1>
5+
<div>
6+
<c-button>Clique Aqui</c-button>
7+
<c-button-props primary>Clique Aqui</c-button-props>
8+
<c-button-props-cond>Clique Aqui Condicional</c-button-props-cond>
9+
</div>
10+
</div>
11+
</template>
12+
13+
<script>
14+
import CButton from '@/components/elements/Button'
15+
import CButtonProps from '@/components/elements/ButtonProps'
16+
import CButtonPropsCond from '@/components/elements/ButtonPropsCond'
17+
export default {
18+
name: 'app',
19+
components: {
20+
CButton, CButtonProps, CButtonPropsCond
21+
}
22+
}
23+
</script>
24+
25+
<style>
26+
#app {
27+
font-family: 'Avenir', Helvetica, Arial, sans-serif;
28+
-webkit-font-smoothing: antialiased;
29+
-moz-osx-font-smoothing: grayscale;
30+
text-align: center;
31+
color: #2c3e50;
32+
margin-top: 60px;
33+
}
34+
</style>

src/assets/logo.png

6.69 KB
Loading

src/components/elements/Button.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import styled from "vue-styled-components";
2+
3+
const CButton = styled.button`
4+
font-size: 1em;
5+
text-align: center;
6+
color: #FFFFFF;
7+
border-radius: 5px;
8+
padding: 10px 15px;
9+
background-color: #0057AA;
10+
`;
11+
12+
export default CButton;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import styled from "vue-styled-components";
2+
3+
const typeButton = { primary: Boolean };
4+
5+
const CButtonProps = styled('button', typeButton)`
6+
font-size: 1em;
7+
text-align: center;
8+
color: ${props => props.primary ? '#0057AA' : '#FFFFFF'};
9+
border-radius: 5px;
10+
padding: 10px 15px;
11+
background-color: ${props => props.primary ? '#FFFFFF' : '#0057AA'};
12+
`;
13+
14+
export default CButtonProps;

0 commit comments

Comments
 (0)