From 24020c0f052338b34df3e96f26085e3edcbf5ffc Mon Sep 17 00:00:00 2001 From: Dean Mikan Date: Mon, 4 May 2020 23:29:23 +1000 Subject: [PATCH 1/2] Replaced 'date' prop with 'opposite' prop to have optional String or Date as side text --- src/components/VueTimelineUpdate.vue | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/components/VueTimelineUpdate.vue b/src/components/VueTimelineUpdate.vue index b077739..863eeb3 100644 --- a/src/components/VueTimelineUpdate.vue +++ b/src/components/VueTimelineUpdate.vue @@ -14,7 +14,7 @@ article( ]` ) .gb-vue-timeline-update__left - span.gb-vue-timeline-update__ago {{ ago }} + span.gb-vue-timeline-update__ago {{ oppositeText }} .gb-vue-timeline-update__center base-number( @@ -48,7 +48,7 @@ article( size="small" ) {{ category }} - span.gb-vue-timeline-update__ago {{ ago }} + span.gb-vue-timeline-update__ago {{ oppositeText }} h2( v-html="title" @@ -134,9 +134,9 @@ export default { ) } }, - date: { - type: Date, - required: true + opposite: { + type: [String, Date], + default: "" }, description: { type: String, @@ -161,9 +161,15 @@ export default { }, computed: { - ago() { - return format(this.date) - } + oppositeText() { + if (typeof this.opposite == "object") { + // Must be date + return format(this.opposite) + } + + // Otherwise just return string + return this.opposite + }, }, mounted() { From 8af1fb6092fc0420dd3797ac2c4366794db1b16c Mon Sep 17 00:00:00 2001 From: Dean Mikan Date: Mon, 4 May 2020 23:34:31 +1000 Subject: [PATCH 2/2] Updated README to reflect changes and updated version --- README.md | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a74212c..d4913a6 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Once the plugin is installed, you can use the component like this: