-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] Update the modal component
Also, create the checkout component
- Loading branch information
Bruno Garcia
committed
Aug 7, 2021
1 parent
9050e47
commit cda3bdf
Showing
7 changed files
with
122 additions
and
73 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<template> | ||
<div class="checkout-wrapper"> | ||
<Title title="Resume" /> | ||
|
||
<h2 class="checkout-title">Subtotal</h2> | ||
|
||
<ul class="checkout-items border"> | ||
<li> | ||
<span>{{ totalItems }} Items </span> | ||
<span> | ||
{{ totalCost }} | ||
<span class="currency">€</span> | ||
</span> | ||
</li> | ||
</ul> | ||
|
||
<div v-if="displayDiscount()"> | ||
<h2 class="checkout-title">Discounts</h2> | ||
|
||
<ul class="checkout-items border"> | ||
<li v-for="item in discountsApplied" :key="item.code"> | ||
<span>{{ item.literal }}</span> | ||
<span>-{{ item.total }}€</span> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<h2 class="checkout-title">Total to pay</h2> | ||
|
||
<ul class="checkout-items border"> | ||
<li> | ||
<span>Total</span> | ||
<span>{{ totalCostWithDiscounts }}€ </span> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from "vue"; | ||
import { mapGetters } from "vuex"; | ||
import Title from "@/components/Title.vue"; | ||
export default defineComponent({ | ||
name: "Checkout", | ||
components: { | ||
Title | ||
}, | ||
computed: { | ||
...mapGetters({ | ||
totalCost: "shopping/totalCost", | ||
totalItems: "shopping/totalItems", | ||
discountsApplied: "shopping/discountsApplied", | ||
totalCostWithDiscounts: "shopping/totalCostWithDiscounts" | ||
}) | ||
}, | ||
methods: { | ||
displayDiscount() { | ||
return this.discountsApplied.length > 0; | ||
} | ||
} | ||
}); | ||
</script> | ||
|
||
<style scoped> | ||
.checkout-title { | ||
margin-top: 1em; | ||
} | ||
.checkout-items { | ||
margin-bottom: 1em; | ||
padding-bottom: 1em; | ||
border-bottom: 1px solid rgba(33, 34, 64, 0.16); | ||
} | ||
.checkout-items li { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
.checkout-items li > *:nth-child(2) { | ||
font-weight: bold; | ||
} | ||
.checkout-items li + li { | ||
margin-top: 20px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters