diff --git a/front/src/lib/cart.ts b/front/src/lib/cart.ts index a452546..fb55313 100644 --- a/front/src/lib/cart.ts +++ b/front/src/lib/cart.ts @@ -47,7 +47,10 @@ function createCartStore() { cart.update((cart: Record) => { if (cart[uuid].amount <= 0) { delete cart[uuid]; // skipcq: JS-0320 + } else if (cart[uuid].amount > 99) { + cart[uuid].amount = 99; // skipcq: JS-0320 } + return cart; }); } @@ -103,8 +106,8 @@ Cart.subscribe((value) => { }); // Debug -Cart.subscribe((value) => { - console.log(value); -}); +// Cart.subscribe((value) => { +// console.log(value); +// }); export default Cart; diff --git a/front/src/pages/PageItem.svelte b/front/src/pages/PageItem.svelte index f6ff2a0..f9f2558 100644 --- a/front/src/pages/PageItem.svelte +++ b/front/src/pages/PageItem.svelte @@ -1,5 +1,5 @@
@@ -62,7 +78,15 @@

{item.description}

- +
+ +

{basketAmount}

+ +
+ +
+ + {:catch error}
@@ -103,6 +127,7 @@ > div { margin-bottom: $spacing-small; + padding: $spacing-small; width: 650px; height: 500px; @@ -111,11 +136,14 @@ justify-content: center; align-items: center; + border-radius: $border-radius-normal; + background-color: $color-background; + overflow: hidden; > img { - max-width: 650px; - max-height: 500px; + max-width: 100%; + max-height: 100%; border-radius: $border-radius-normal; } @@ -161,27 +189,83 @@ } } - #add-to-cart { - padding: 0 $spacing-normal; - - height: 30px; - + #basket-controls { display: flex; - justify-content: center; - align-items: center; + flex-direction: row; - text-shadow: 0 1px 0.5px rgba($color-dark, 0.3);; + > .button { + min-width: 35px; + height: 35px; - border: 0 solid transparent; - border-radius: 9999px; - background-color: $color-primary; - color: $color-on-primary; + display: flex; + justify-content: center; + align-items: center; + + font-family: $font-family; + font-size: $font-size-p; + + border: 1px solid rgba($color-dark, 0.2); + border-radius: $border-radius-normal; + background-color: $color-light; + color: $color-on-light; + + &:hover { + border: 1px solid rgba($color-dark, 0.4); + } + &:focus-visible { + border: 1px solid rgba($color-primary, 0.9); + outline: 0 solid transparent; + } + + &.add { + padding: 0 $spacing-normal; + border: 0 solid transparent; + background-color: $color-dark; + color: $color-on-dark; + + &:hover, + &:focus-visible { + background-color: $color-primary; + color: $color-on-primary; + } + } + + &.disabled { + border: 1px solid rgba($color-dark, 0.1); + color: rgba($color-on-light, 0.6); + + &:hover, + &:focus-visible { + border: 1px solid rgba($color-dark, 0.1); + background-color: $color-light; + color: rgba($color-on-light, 0.6); + } + } + } + + > p { + width: 40px; + height: 35px; + + display: flex; + justify-content: center; + align-items: center; + + font-family: $font-family; + font-size: $font-size-p; + + border: 1px solid transparent; + color: $color-on-light; + } + + > hr { + margin: 0 $spacing-small; + + width: 1px; + height: 100%; - &:hover, &:focus { border: 0 solid transparent; - background-color: $color-dark; - color: $color-on-dark; - outline: 0 solid transparent + background-color: rgba($color-dark, 0.1); } }