s10 quote app adding

This commit is contained in:
Tyrel Souza 2018-04-18 23:10:01 -04:00
parent 5b7e15ba41
commit 9efff3d592
12 changed files with 7029 additions and 0 deletions

5
s10QuoteApp/.babelrc Normal file
View File

@ -0,0 +1,5 @@
{
"presets": [
["es2015", { "modules": false }]
]
}

18
s10QuoteApp/README.md Normal file
View File

@ -0,0 +1,18 @@
# vue-cli
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
```
For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).

14
s10QuoteApp/index.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vue Components</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href='https://fonts.googleapis.com/css?family=Arizonia' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="app">
</div>
<script src="/dist/build.js"></script>
</body>
</html>

6772
s10QuoteApp/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

25
s10QuoteApp/package.json Normal file
View File

@ -0,0 +1,25 @@
{
"name": "vue-cli",
"description": "A Vue.js project",
"author": "Maximilian Schwarzmüller <mblacky0@gmail.com>",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --inline --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"bootstrap": "^3.3.7",
"vue": "^2.0.1"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-es2015": "^6.0.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"vue-loader": "^9.7.0",
"webpack": "2.1.0-beta.25",
"webpack-dev-server": "2.1.0-beta.0"
}
}

39
s10QuoteApp/src/App.vue Normal file
View File

@ -0,0 +1,39 @@
<template>
<div class="container">
<h1>Quotes</h1>
<app-new-quote @newQuote="newQuote"></app-new-quote>
<hr>
<app-quote-grid :quotes="quotes"></app-quote-grid>
<div class="row">
<div class="col-sm-12 text-center">
<div class="alert alert-info">click a quote to delete it.</div>
</div>
</div>
</div>
</template>
<script>
import QuoteGrid from './components/QuoteGrid.vue'
import NewQuote from './components/NewQuote.vue'
export default {
data(){
return {
maxQuotes: 10,
quotes: ["Just a quote to see something"],
};
},
components: {
appQuoteGrid: QuoteGrid,
appNewQuote: NewQuote,
},
methods: {
newQuote(quote) {
this.quotes.push(quote)
},
},
}
</script>
<style>
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,33 @@
<template>
<div class="row">
<div class="col-sm-8 col-sm-offset-2 col-xs-12 col-md-6 col-md-offset-3 form-group">
<form>
<label>Quote</label>
<textarea class="form-control" rows="3" v-model="quote"></textarea>
</form>
</div>
<div class="col-sm-8 col-sm-offset-2 col-xs-12 col-md-6 col-md-offset-3 form-group">
<button class="btn btn-primary" @click.prevent="createNew">Add Quote</button>
</div>
</div>
</template>
<script>
export default {
data(){
return {
quote: ''
};
},
methods: {
createNew(){
this.$emit('newQuote', this.quote);
this.quote = '';
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,29 @@
<template>
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="panel panel-default">
<div class="panel-body quote">
<slot></slot>
</div>
</div>
</div>
</template>
<script>
export default {
props: ['quote'],
}
</script>
<style scoped>
.panel-body {
font-family: 'Arizonia', cursive;
font-size: 24px;
color: #6e6e6e;
}
.quote{
cursor: pointer;
}
.quote:hover {
background-color: #ffe2e2; }
</style>

View File

@ -0,0 +1,22 @@
<template>
<div class="row">
<app-quote v-for='quote in quotes'>
{{quote}}
</app-quote>
</div>
</template>
<script>
import Quote from './Quote.vue'
export default {
props: ['quotes'],
components: {
appQuote: Quote,
}
}
</script>
<style scoped>
</style>

8
s10QuoteApp/src/main.js Normal file
View File

@ -0,0 +1,8 @@
import Vue from 'vue'
import App from './App.vue'
new Vue({
el: '#app',
render: h => h(App)
})

View File

@ -0,0 +1,64 @@
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue',
options: {
// vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue'
}
},
devServer: {
historyApiFallback: true,
noInfo: true
},
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}