From 403c7bbe6c1e794f67ac103777d98ec3baf9f4f6 Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Thu, 4 Apr 2019 13:26:08 -0400
Subject: add reusable progress-button cmoponent

---
 src/components/progress_button/progress_button.vue | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 src/components/progress_button/progress_button.vue

(limited to 'src/components/progress_button/progress_button.vue')

diff --git a/src/components/progress_button/progress_button.vue b/src/components/progress_button/progress_button.vue
new file mode 100644
index 00000000..3fea2418
--- /dev/null
+++ b/src/components/progress_button/progress_button.vue
@@ -0,0 +1,35 @@
+<template>
+  <button :disabled="progress || disabled" @click="onClick">
+    <template v-if="progress">
+      <slot name="progress" />
+    </template>
+    <template v-else>
+      <slot />
+    </template>
+  </button>
+</template>
+
+<script>
+export default {
+  props: {
+    disabled: {
+      type: Boolean
+    },
+    click: {
+      type: Function,
+      default: () => Promise.resolve()
+    }
+  },
+  data () {
+    return {
+      progress: false
+    }
+  },
+  methods: {
+    onClick () {
+      this.progress = true
+      this.click().then(() => { this.progress = false })
+    }
+  }
+}
+</script>
-- 
cgit v1.2.3-70-g09d2


From 7e74a13fcf0dc8552094dd2bb86ad6ec13389098 Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Thu, 4 Apr 2019 13:45:46 -0400
Subject: add a comment

---
 src/components/progress_button/progress_button.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/components/progress_button/progress_button.vue')

diff --git a/src/components/progress_button/progress_button.vue b/src/components/progress_button/progress_button.vue
index 3fea2418..737360bb 100644
--- a/src/components/progress_button/progress_button.vue
+++ b/src/components/progress_button/progress_button.vue
@@ -15,7 +15,7 @@ export default {
     disabled: {
       type: Boolean
     },
-    click: {
+    click: { // click event handler. Must return a promise
       type: Function,
       default: () => Promise.resolve()
     }
-- 
cgit v1.2.3-70-g09d2

