From 7e23ee4591733c9f70810bd764e6bd6d12c5d12f Mon Sep 17 00:00:00 2001 From: Tixie Date: Tue, 23 Apr 2019 00:41:01 +0200 Subject: [PATCH] feat(option panel): Setup timer options --- src/assets/css/4-modules/options.css | 27 ++++++++++++++++--- src/store.js | 5 ++++ src/views/components/capture-options.vue | 33 +++++++++++++++++++++--- src/views/icons/ico-timer.vue | 5 ++++ src/views/screens/capture.vue | 4 ++- src/views/screens/preview.vue | 2 +- 6 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 src/views/icons/ico-timer.vue diff --git a/src/assets/css/4-modules/options.css b/src/assets/css/4-modules/options.css index cb04411..740378a 100644 --- a/src/assets/css/4-modules/options.css +++ b/src/assets/css/4-modules/options.css @@ -59,11 +59,29 @@ height: 1.5rem; background: url("/assets/img/boomerang-check.svg"); content: ""; - animation: btnCheckArrive .5s cubic-bezier(.18,.89,.32,1.28); + animation: btnOptionArrive .5s cubic-bezier(.18,.89,.32,1.28); animation-delay: 100ms; } -@keyframes btnCheckArrive { +.options__btn--timer { + position: relative; +} + +.options__btn--timer::after { + position: absolute; + right: 1.8rem; + bottom: 1.6rem; + color: #fff; + content: attr(data-timer); + text-align: right; + text-shadow: .2rem 0 0 var(--color-tertiary), -.2rem 0 0 var(--color-tertiary), 0 .2rem 0 var(--color-tertiary), 0 -.2rem 0 var(--color-tertiary), 1px 1px var(--color-tertiary), -1px -1px 0 var(--color-tertiary), 1px -1px 0 var(--color-tertiary), -1px 1px 0 var(--color-tertiary); + font-weight: 600; + font-size: 1.3rem; + line-height: normal; + animation: btnOptionArrive .5s cubic-bezier(.18,.89,.32,1.28); +} + +@keyframes btnOptionArrive { 0% { transform: scale(1); } @@ -74,7 +92,6 @@ transform: scale(1); } } - /* Panel -------------------------------------------------------------- */ @@ -113,6 +130,10 @@ cursor: pointer; } +.option__panelOption--big { + font-size: 1.6rem; +} + .option__panelOption.current { background-color: var(--color-primary); } diff --git a/src/store.js b/src/store.js index c8d431e..3cc54c9 100644 --- a/src/store.js +++ b/src/store.js @@ -14,6 +14,7 @@ export default new Vuex.Store({ list: [2, 3, 5] }, boomerang: false, + timer: 0, camera: null, capture: null, gif: null, @@ -29,6 +30,10 @@ export default new Vuex.Store({ updateBoomerang (state, value) { state.boomerang = value }, + updateTimer (state, value) { + console.log(typeof value) + state.timer = value + }, updateCamera (state, camera) { if (state.camera) { state.camera.mediaStream.getTracks().forEach(track => track.stop()) diff --git a/src/views/components/capture-options.vue b/src/views/components/capture-options.vue index f29696e..e640191 100644 --- a/src/views/components/capture-options.vue +++ b/src/views/components/capture-options.vue @@ -6,13 +6,21 @@ {{ timeLabel(time) }} - +
+
+ + + +
@@ -20,17 +28,20 @@ import { mapState } from 'vuex' import iconBoomerang from '/views/icons/ico-boomerang' +import iconTimer from '/views/icons/ico-timer' import iconDisabled from '/views/icons/ico-disabled' export default { name: 'captureOptions', components: { iconBoomerang, + iconTimer, iconDisabled }, data () { return { - boomerangOpen: false + boomerangOpen: false, + timerOpen: false } }, props: { @@ -45,12 +56,17 @@ export default { disabledBoomerang: { type: Boolean, default: false + }, + disabledTimer: { + type: Boolean, + default: false } }, computed: { ...mapState([ 'duration', - 'boomerang' + 'boomerang', + 'timer' ]), selectedTime: { get: function () { return this.duration.selected }, @@ -73,7 +89,18 @@ export default { updateBoomerang (value) { this.$store.commit('updateBoomerang', value) this.closeBoomerang() + }, + openTimer () { + this.timerOpen = true + }, + closeTimer () { + this.timerOpen = false + }, + updateTimer (value) { + this.$store.commit('updateTimer', value) + this.closeTimer() } + } } diff --git a/src/views/icons/ico-timer.vue b/src/views/icons/ico-timer.vue new file mode 100644 index 0000000..45d6df7 --- /dev/null +++ b/src/views/icons/ico-timer.vue @@ -0,0 +1,5 @@ + diff --git a/src/views/screens/capture.vue b/src/views/screens/capture.vue index 7ca6a1c..37ba31c 100644 --- a/src/views/screens/capture.vue +++ b/src/views/screens/capture.vue @@ -36,7 +36,9 @@ export default { }, data: () => ({ capturing: false, - capturingProgress: 0 + capturingProgress: 0, + countdown: false, + countdownProgress: 0 }), computed: { ...mapState([ diff --git a/src/views/screens/preview.vue b/src/views/screens/preview.vue index f862c17..ed3b857 100644 --- a/src/views/screens/preview.vue +++ b/src/views/screens/preview.vue @@ -1,6 +1,6 @@