Skip to content

Commit

Permalink
Merge pull request #1 from Ade94/workingcard
Browse files Browse the repository at this point in the history
card
  • Loading branch information
adecrown committed Feb 12, 2020
2 parents d6c33c2 + b36b1c8 commit c0356bb
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 68 deletions.
24 changes: 20 additions & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
"presets": [
["@babel/preset-env", {
"modules": false
}]
],
"env": {
"test": {
"presets": [
["@babel/preset-env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"],
node: 'current'
}
}]
],
"plugins": ["@babel/plugin-transform-runtime"]
}
},
"plugins": ["@babel/plugin-syntax-dynamic-import", "transform-dynamic-import"]
}
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
"vue": "^2.6.11"
},
"devDependencies": {
"@babel/core": "^7.6.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.6.0",
"babel-plugin-transform-dynamic-import": "^2.1.0",
"@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-eslint": "^4.2.0",
"@vue/cli-service": "^4.2.0",
Expand Down
3 changes: 1 addition & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<HelloWorld msg="Welcome to Your Vue.js App" />
</div>
</template>

Expand Down
32 changes: 4 additions & 28 deletions src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -1,38 +1,14 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
<div>
<Card />
</div>
</template>

<script>
import Card from './Whoosh/Card'
export default {
name: 'HelloWorld',
components: { Card },
props: {
msg: String
}
Expand Down
16 changes: 0 additions & 16 deletions src/components/Whoosh.vue

This file was deleted.

45 changes: 45 additions & 0 deletions src/components/Whoosh/Card.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<template>
<div
class="card"
:style="{'margin-bottom':setMargin}"
>
<div class="card__status"></div>
Testings
</div>
</template>
<script>
export default {
props: {
position: {
type: Number,
required: false,
default: 0
}
},
computed: {
setMargin() {
const marg = this.position * 210
return this.position > 0 ? marg + 'px' : '0px'
}
},
}
</script>

<style scoped>
.card {
width: 500px;
height: 200px;
position: absolute;
bottom: 10px;
right: 10px;
box-shadow: 0px 2px 20px rgba(0, 0, 0, 0.07);
background-color: white;
}
.card__status {
background-color: green;
width: 95%;
height: 10px;
border-radius: 20px;
}
</style>

34 changes: 34 additions & 0 deletions src/components/Whoosh/Whoosh.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<template>
<div>
<Card
v-for="(whooshes,index) in whooshList"
:key="index"
:position="index"
/>
</div>
</template>

<script>
import Card from './Card'
import { events } from './events.js'
export default {
name: 'Whoosh',
components: { Card },
data() {
return {
show: false,
whooshList: []
}
},
mounted() {
console.log("Mounted Whoosh")
events.$on('startWhoosh', this.makeAWhooshList);
},
methods: {
makeAWhooshList(event) {
this.whooshList.push(event)
}
}
}
</script>
5 changes: 5 additions & 0 deletions src/components/Whoosh/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Vue from 'vue'

export const events = new Vue({
name: 'Whoosh'
})
43 changes: 25 additions & 18 deletions src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
import Vue from 'vue'
//import Vue from 'vue'
import ButtonField from './ButtonField'
import Whoosh from './Whoosh'
import Whoosh from './Whoosh/Whoosh'
import {
events
} from './Whoosh/events'
//const myWhoosh = new(Vue.extend(Whoosh));

const myWhoosh = new (Vue.extend(Whoosh));
const WhooshOn = {
install(Vue, args = {}) {
console.log('Installed')
this.params = args

export default function install (Vue) {
Vue.component('ButtonField',ButtonField)
Vue.component('ButtonField', ButtonField)
Vue.component('Whoosh', Whoosh)

//Vue.prototype.$whoosh = (name, age) => info(name, age)

Vue.prototype.$whoosh = {
success(message){
myWhoosh.success(message)
},
error(message){
myWhoosh.success(message)
}
}

Vue.prototype.$whoosh = (params) => {
events.$emit('startWhoosh', params)
}
}
}

export {
ButtonField
}
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(WhooshOn)
}

export default WhooshOn
export {
ButtonField,
Whoosh
}

0 comments on commit c0356bb

Please sign in to comment.