diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2020-01-27 17:42:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 17:42:53 +0100 |
commit | 3c2ac6715dfffc2eda38e014ed0b4986ccc7f75a (patch) | |
tree | 6fe224aac15e46ed4f527b12b86fdac7ab376b29 /components/DayCountdown.vue | |
parent | 5305c18b05803bf0d032027e645c71ac59627621 (diff) | |
parent | 6582d35072ee2bb81e0600311292aca63a1fd0eb (diff) | |
download | puszcza-3c2ac6715dfffc2eda38e014ed0b4986ccc7f75a.tar.gz puszcza-3c2ac6715dfffc2eda38e014ed0b4986ccc7f75a.zip |
Merge pull request #24 from 19pdh/oboz
Oboz
Diffstat (limited to 'components/DayCountdown.vue')
-rw-r--r-- | components/DayCountdown.vue | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/components/DayCountdown.vue b/components/DayCountdown.vue new file mode 100644 index 0000000..9415917 --- /dev/null +++ b/components/DayCountdown.vue @@ -0,0 +1,47 @@ +<template> + <client-only> + <div class="countdown"> + {{ text }} <span>{{ days }} dni</span> + </div> + </client-only> +</template> + +<script> +export default { + name: 'DayCountdown', + props: { + text: { + type: String, + required: true, + }, + endDate: { + type: Date, + required: true, + }, + startDate: { + type: Date, + default: () => new Date(Date.now()), + }, + }, + computed: { + days() { + return Math.round( + (this.endDate.getTime() - this.startDate.getTime()) / 86400000 + ) + }, + }, +} +</script> + +<style> +.countdown { + background: #ffffff; + box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.2); + padding: 20px; + margin: 50px 10px; +} + +.countdown span { + font-weight: 600; +} +</style> |