Cleaned up cart page, now with tables.

This commit is contained in:
2020-07-19 16:12:48 +02:00
parent 9d2cd9e9f9
commit 2ce06580a8

View File

@@ -7,45 +7,54 @@
</div> </div>
<div class="row header"> <table cellspaceing="0" class="cart-inventory">
<h2>Product</h2> <thead>
<h2>Pris</h2> <tr>
<h2>Quantity</h2> <th>Product</th>
<h2>Delsum</h2> <th>Price</th>
</div> <th>Quantity</th>
<th>Delsum</th>
<div class="row"> </tr>
<div class="product"> </thead>
<img src="https://planetposen.no/no/Kjp_na_files/Media/IMG_1244/IMG_1244.jpg" /> <tbody>
<tr v-for="product in cartInventory">
<div class="flex-direction-column"> <td class="name-and-image">
<h3>Christmas joy</h3> <img :src="product.image" />
</div> <span>{{ product.name }}</span>
</div> </td>
<span class="price">30.99 $</span> <td>38.99 NOK</td>
<div class="info"> <td>2</td>
<Picker></Picker> <td>77.99 NOK</td>
</div> </tr>
<span class="price">61.98 $</span> </tbody>
</div> </table>
<div class="row">
<div class="product">
<img src="https://planetposen.no/no/Kjp_na_files/Media/IMG_1244/IMG_1244.jpg" />
<div class="flex-direction-column">
<h3>Christmas joy</h3>
</div>
</div>
<span class="price">30.99 $</span>
<div class="info">
<Picker></Picker>
</div>
<span class="price">30.99 $</span>
</div>
<section class="checkout"> <section class="checkout">
<h2>Totalt i handlekurven</h2> <h2>Totalt i handlekurven</h2>
<div class="checkout-summary"> <div class="checkout-summary">
<table cellspacing="0">
<tbody>
<tr>
<th>Delsum</th>
<td data-title="Delsum">
<span>388 kr</span>
</td>
</tr>
<tr class="frakt">
<th>Frakt</th>
<td data-title="Frakt">
<span>49 kr</span>
<p>Fraktalternativer vil bli oppdatert betalingssiden.</p>
</td>
</tr>
<tr>
<th>Total</th>
<td data-title="Total">
<span>437 kr</span>
</td>
</tr>
</tbody>
</table>
<Button color="blue" :scaleRotate="true"> til kassen</Button> <Button color="blue" :scaleRotate="true"> til kassen</Button>
</div> </div>
@@ -56,6 +65,7 @@
<script> <script>
import store from '@/store';
import Picker from '@/components/ui/Picker' import Picker from '@/components/ui/Picker'
import Button from '@/components/ui/Button' import Button from '@/components/ui/Button'
@@ -64,6 +74,16 @@ export default {
components: { components: {
Picker, Picker,
Button Button
},
computed: {
cartInventory() {
return store.getters['cartModule/inventory'];
}
},
methods: {
removeFromCart(product) {
store.dispatch('cartModule/removeItemFromCart', product)
}
} }
} }
</script> </script>
@@ -74,21 +94,94 @@ export default {
.checkout { .checkout {
@include desktop { @include desktop {
float: right;
width: 55%; width: 55%;
} }
margin: 2rem 0;
h2 { h2 {
margin: 1rem 0; margin: 1rem 0;
} }
&-summary { &-summary {
height: 10px;
background-color: red;
width: 100%; width: 100%;
} }
} }
table.cart-inventory {
table-layout: fixed;
@include desktop {
table-layout: auto;
th:first-of-type {
width: 55%;
}
th:not(:first-of-type) {
width: 15%;
}
}
.name-and-image {
display: flex;
align-items: center;
img {
margin-right: 1rem;
width: auto;
height: 40px;
border-radius: 4px;
}
}
thead tr th {
border-bottom: 2px solid rgba(255,255,255,.1);
&:not(:last-of-type) {
border-right: 2px solid rgba(255,255,255,.1);
}
}
tbody tr:last-of-type td {
border-bottom: 0px solid;
}
}
.checkout-summary table {
tr:last-of-type {
th, td {
border-bottom: 0px solid;
}
}
.frakt p {
font-size: 0.9em;
}
}
table {
width: 100%;
border: 1px solid rgba(255,255,255,.1);
border-radius: 6px;
margin-bottom: 1.5rem;
font-size: 1.2em;
tr th, tr td {
border-bottom: 2px solid rgba(255,255,255,.1);
}
th, td {
padding: 0.75rem 1rem;
}
th {
width: 35%;
text-align: left;
vertical-align: top;
}
}
.page-header { .page-header {
margin-bottom: 3rem; margin-bottom: 3rem;
@@ -107,118 +200,7 @@ export default {
font-weight: 400; font-weight: 400;
} }
} }
img {
.row {
display: flex;
flex-direction: row;
height: 100%;
margin-bottom: 1rem;
padding: 1rem;
border: 1px solid white;
&:first-of-type {
height: min-content;
}
> *:first-child {
width: calc(70% - 1rem);
// background-color: violet;
margin-right: 1rem;
display: flex;
flex-direction: row;
img {
height: 80px;
margin-right: 1rem;
}
h3 {
letter-spacing: 1.2px;
font-weight: normal;
margin: 0;
margin-top: 0.3rem;
}
p {
font-weight: 300;
}
}
> *:nth-child(3) {
width: calc(15% - 1rem);
margin-right: 1rem;
display: flex;
align-items: center;
// background-color: navy;
}
> *:nth-child(2) {
width: calc(15%);
// background-color: #F28500;
font-size: 1.5rem;
margin: auto;
}
> *:nth-child(4) {
width: calc(15%);
// background-color: #F28500;
font-size: 1.5rem;
margin: auto;
}
&:last-child {
// background-color: green;
}
img {
height: 100%;
width: auto;
height: 150px;
border-radius: 4px;
}
// &.header {
// height: min-content;
// h2 {
// font-weight: 300;
// }
// }
// .product {
// width: 60%;
// height: 100%;
// display: inherit;
// flex-direction: inherit;
// align-items: center;
// img {
// height: 100%;
// width: auto;
// margin-right: 2rem;
// }
// h3, p {
// margin: 0;
// }
// h3 {
// font-weight: 500;
// font-size: 1.5rem;
// margin-bottom: 0.5rem;
// }
// }
// .info {
// width: 40%;
// display: inherit;
// flex-direction: inherit;
// h2 {
// width: 50%;
// }
// }
} }
</style> </style>