feat: Add download screen

This commit is contained in:
Tixie 2019-03-10 00:55:37 +01:00
parent a92d7f8149
commit 8f1f54e574
10 changed files with 111 additions and 48 deletions

View file

@ -1,7 +1,8 @@
<template> <template>
<div class="layout"> <div class="layout">
<welcome-screen v-if="!welcomed"/> <welcome-screen v-if="!welcomed && !downloading.status"/>
<capture-screen v-else/> <capture-screen v-if="welcomed && !downloading.status"/>
<download-screen v-if="downloading.status"/>
</div> </div>
</template> </template>
@ -9,6 +10,7 @@
import welcomeScreen from '@/views/welcome' import welcomeScreen from '@/views/welcome'
import captureScreen from '@/views/capture' import captureScreen from '@/views/capture'
import downloadScreen from '@/views/download'
import { mapState } from 'vuex' import { mapState } from 'vuex'
@ -16,11 +18,13 @@ export default {
name: 'souvenir', name: 'souvenir',
components: { components: {
welcomeScreen, welcomeScreen,
captureScreen captureScreen,
downloadScreen
}, },
computed: { computed: {
...mapState([ ...mapState([
'welcomed' 'welcomed',
'downloading'
]) ])
} }
} }

View file

@ -0,0 +1,43 @@
/* ----------------------------------------------------------- */
/* == Options bar module */
/* ----------------------------------------------------------- */
/* Options
-------------------------------------------------------------- */
.options {
display: flex;
justify-content: space-between;
align-items: center;
padding: 2.2rem 0;
}
.options__select,
.options__btn {
padding: 2rem;
border: .1rem solid transparent;
border-radius: .3rem;
background: transparent;
color: #fff;
line-height: 2.2rem;
cursor: pointer;
appearance: none;
}
.options__select:focus,
.options__btn:focus {
outline: none;
box-shadow: var(--focus-ring);
}
.options__select {
padding-right: 4.4rem;
background: url("/img/ico-arrow.svg") no-repeat;
background-position: calc(100% - 2rem) center;
}
.options__btn svg {
margin-right: 1.5rem;
}

View file

@ -4,21 +4,23 @@
.preview { .preview {
position: relative; position: relative;
overflow: hidden;
margin-bottom: 2rem; margin-bottom: 2rem;
border-radius: .5rem;
background-color: rgba(0, 0, 0, .5);
box-shadow: 0 .4rem 5rem rgba(0, 0, 0, .5);
} }
.preview-visual { .preview-visual {
position: relative; position: relative;
width: 100%; width: 100%;
border-radius: 5px;
background-color: rgba(0, 0, 0, .5);
box-shadow: 0px 4px 50px rgba(0, 0, 0, .5);
} }
.preview::after { .preview::after {
position: absolute; position: absolute;
top: calc(50% - (3em / 2)); top: calc(50% - (3em / 2));
left: calc(50% - (3em / 2)); left: calc(50% - (3em / 2));
z-index: -1;
display: block; display: block;
width: 3em; width: 3em;
height: 3em; height: 3em;

View file

@ -7,44 +7,6 @@
flex-direction: column; flex-direction: column;
flex-grow: 1; flex-grow: 1;
} }
/* Options
-------------------------------------------------------------- */
.capture-options {
display: flex;
justify-content: space-between;
align-items: center;
padding: 2.2rem 0;
}
.capture-options__select,
.capture-options__switch {
padding: 2rem;
border: .1rem solid transparent;
border-radius: .3rem;
background: transparent;
color: #fff;
line-height: 2.2rem;
cursor: pointer;
appearance: none;
}
.capture-options__select:focus,
.capture-options__switch:focus {
outline: none;
box-shadow: var(--focus-ring);
}
.capture-options__select {
padding-right: 4.4rem;
background: url("/img/ico-arrow.svg") no-repeat;
background-position: calc(100% - 2rem) center;
}
.capture-options__switch svg {
margin-right: 1.5rem;
}
/* Progress bar /* Progress bar
-------------------------------------------------------------- */ -------------------------------------------------------------- */

View file

@ -0,0 +1,15 @@
/* ----------------------------------------------------------- */
/* == Download screen */
/* ----------------------------------------------------------- */
.download {
display: flex;
flex-direction: column;
flex-grow: 1;
}
.download-btn,
.download-btn:visited {
margin-top: auto;
margin-bottom: 4rem;
}

View file

@ -30,6 +30,7 @@
/* == modules */ /* == modules */
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@import "4-modules/options.css";
@import "4-modules/preview.css"; @import "4-modules/preview.css";
@import "4-modules/progress-bar.css"; @import "4-modules/progress-bar.css";
@import "4-modules/encoding.css"; @import "4-modules/encoding.css";
@ -40,6 +41,7 @@
@import "5-screens/welcome.css"; @import "5-screens/welcome.css";
@import "5-screens/capture.css"; @import "5-screens/capture.css";
@import "5-screens/download.css";
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* == helpers */ /* == helpers */

View file

@ -1,11 +1,11 @@
<template lang="html"> <template lang="html">
<div class="capture-options"> <div class="options">
<select class="capture-options__select" v-model="timer.selected" @change="updateTimer(timer.selected)" :disabled="encoding.status"> <select class="options__select" v-model="timer.selected" @change="updateTimer(timer.selected)" :disabled="encoding.status">
<option v-for="time in timer.list" :key="time" :value="time"> <option v-for="time in timer.list" :key="time" :value="time">
{{ timeLabel(time) }} {{ timeLabel(time) }}
</option> </option>
</select> </select>
<button class="capture-options__switch" @click="back" :disabled="encoding.status"><icon-switch/>switch</button> <button class="options__btn" @click="back" :disabled="encoding.status"><icon-switch/>switch</button>
</div> </div>
</template> </template>

View file

@ -29,6 +29,7 @@ export default {
this.makeLoading() this.makeLoading()
window.setTimeout(() => { window.setTimeout(() => {
this.$store.commit('stopEncoding') this.$store.commit('stopEncoding')
this.$store.commit('startDownloading')
}, 2000) }, 2000)
}, },
destroyed: function () { destroyed: function () {

View file

@ -16,6 +16,9 @@ export default new Vuex.Store({
}, },
encoding: { encoding: {
status: false status: false
},
downloading: {
status: false
} }
}, },
mutations: { mutations: {
@ -39,6 +42,12 @@ export default new Vuex.Store({
}, },
stopEncoding (store) { stopEncoding (store) {
store.encoding.status = false store.encoding.status = false
},
startDownloading (store) {
store.downloading.status = true
},
stopDownloading (store) {
store.downloading.status = false
} }
}, },
actions: { actions: {

25
src/views/download.vue Normal file
View file

@ -0,0 +1,25 @@
<template>
<div class="download">
<div class="options">
<span></span>
<button class="options__btn" @click="back"> back</button>
</div>
<div class="preview">
<img class="preview-visual" src="https://unsplash.it/320/320" alt="">
</div>
<button class="download-btn btn btn--primary w100">Download GIF</button>
</div>
</template>
<script>
export default {
name: 'download',
methods: {
back () {
this.$store.commit('stopDownloading')
}
}
}
</script>