Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

form proof of concept #21

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/node_modules
/public/hot
/public/storage
/public/js
/public/css
/public/mix-manifest.json
/storage/*.key
/vendor
.env
Expand All @@ -11,3 +14,4 @@ Homestead.yaml
npm-debug.log
yarn-error.log
.idea
.DS_Store
384 changes: 176 additions & 208 deletions package-lock.json

Large diffs are not rendered by default.

Binary file added public/img/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ window.Vue = require('vue');
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
*/

// const files = require.context('./', true, /\.vue$/i)
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))

Vue.component('example-component', require('./components/ExampleComponent.vue').default);
const files = require.context('./', true, /\.vue$/i)
files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))

/**
* Next, we will create a fresh Vue application instance and attach it to
Expand Down
73 changes: 73 additions & 0 deletions resources/js/components/Checkbox.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<template>
<div class="checkbox-list">
<label :class="['checkbox', (selected.includes(value) ? 'selected' : '')]" :for="value" v-for="value in values">
<span class="checkbox-label">{{ value }}</span>
<input type="checkbox"
:id="value"
:name="name"
:value="value"
@change="trigger"
v-model="selected">
</label>
</div>
</template>

<script>
export default {
props: {
values: Array,
name: String,
userValue: Array
},
data() {
return {
selected: []
}
},
mounted() {
this.selected = this.userValue || [];
},
methods: {
trigger(event) {
this.$emit('userInput', event.target.value, event.target.checked);
}
}
}
</script>

<style lang="scss">
.checkbox-list {
display: inline-flex;
flex-direction: column;
}
.checkbox {
position: relative;
display: inline-flex;
padding: 8px 40px 8px 16px;
align-items: center;
border: 1px solid #bada55;
background: rgba(168, 218, 85, .2);

&.selected {
background: rgba(168, 218, 85, .5);
border: 1px solid #617630;

.checkbox-label::after {
position: absolute;
display: flex;
content: '✓';
align-items: center;
top: 0;
right: 4px;
height: 100%;
}
}

&-label {
display: block;
width: 100%;
}

input { display: none;}
}
</style>
23 changes: 0 additions & 23 deletions resources/js/components/ExampleComponent.vue

This file was deleted.

75 changes: 75 additions & 0 deletions resources/js/components/Radio.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<div class="radio-list">
<label :class="['radio', (picked == value.value ? 'selected' : '')]" :for="getId(value)" v-for="value in values">
<span class="radio-label">{{ value.label }}</span>
<input type="radio"
:id="getId(value)"
:name="name"
:value="value.value"
@click="trigger"
v-model="picked">
</label>
</div>
</template>

<script>
export default {
props: {
values: Array,
name: String,
userValue: String
},
data() {
return {
picked: null
}
},
created() {
this.picked = this.userValue;
},
methods: {
getId(value) {
return `o-${value.value}`
},
trigger(event) {
this.$emit('userInput', event.target.value);
}
}
}
</script>

<style lang="scss">
.radio-list {
display: inline-flex;
flex-direction: column;
}
.radio {
position: relative;
display: inline-flex;
padding: 8px 40px 8px 16px;
align-items: center;
border: 1px solid #bada55;
background: rgba(168, 218, 85, .2);

&.selected {
background: rgba(168, 218, 85, .5);

.radio-label::after {
position: absolute;
display: flex;
content: '✓';
align-items: center;
top: 0;
right: 4px;
height: 100%;
}
}

&-label {
display: block;
width: 100%;
}

input { display: none;}
}
</style>
Loading