Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 0 additions & 100 deletions frontend/src/pages/productDetails/ProductDetailsPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -267,57 +267,6 @@
list-style: none;
}

.product-details-page .store-price-row {
display: grid;
grid-template-columns: 24px minmax(0, 1fr) 88px 90px;
align-items: center;
gap: 8px;
min-height: 46px;
padding: 12px 16px;
border-top: 1px solid var(--border-brand);
}

.product-details-page .store-price-row.cheapest {
background: var(--bg-tint);
}

.product-details-page .store-number {
color: var(--text-accent);
font-size: 10px;
font-weight: 700;
}

.product-details-page .store-name {
color: var(--text-primary);
font-size: 13px;
font-weight: 500;
}

.product-details-page .store-difference {
color: var(--text-muted);
font-size: 10px;
text-align: right;
white-space: nowrap;
}

.product-details-page .cheapest .store-difference {
justify-self: end;
padding: 5px 7px;
border-radius: 3px;
background: var(--text-accent);
color: white;
font-size: 9px;
font-weight: 700;
}

.product-details-page .store-price {
color: var(--text-primary);
font-size: 13px;
font-weight: 600;
text-align: right;
white-space: nowrap;
}

/* ===== HANDLELISTE ===== */
.product-details-page .shopping-list-controls {
position: relative;
Expand Down Expand Up @@ -360,41 +309,10 @@
}

.product-details-page .quantity-controls {
display: inline-flex;
align-items: center;
border: 1px solid var(--border-hairline);
border-radius: 5px;
overflow: hidden;
grid-column: 1;
margin-top: 12px;
}

.product-details-page .quantity-controls button {
min-width: 32px;
min-height: 32px;
padding: 4px;
background: var(--bg-surface);
border: none;
color: var(--text-primary);
cursor: pointer;
}

.product-details-page .quantity-controls button:hover:not(:disabled) {
background: var(--bg-tint);
}

.product-details-page .quantity-controls button:disabled {
opacity: 0.4;
cursor: not-allowed;
}

.product-details-page .quantity-controls output {
min-width: 24px;
text-align: center;
font-size: 12px;
color: var(--text-primary);
}

.product-details-page .remove-product {
grid-column: 2;
justify-self: start;
Expand Down Expand Up @@ -510,24 +428,6 @@
}

@media (max-width: 480px) {
.product-details-page .store-price-row {
grid-template-columns: 20px minmax(0, 1fr) auto;
gap: 6px;
padding: 12px;
}

.product-details-page .store-difference {
grid-column: 2;
grid-row: 2;
text-align: left;
justify-self: start;
}

.product-details-page .store-price {
grid-column: 3;
grid-row: 1 / 3;
}

.product-details-page .shopping-list-controls {
padding: 20px 16px;
}
Expand Down
61 changes: 18 additions & 43 deletions frontend/src/pages/productDetails/ProductDetailsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useState } from "react";
import { useQuery } from "@apollo/client/react";
import { PRODUCT_QUERY } from "./productQueries";
import PriceRow from "../../components/priceRow/PriceRow";
import QuantityStepper from "../../components/quantityStepper/QuantityStepper";
import "./ProductDetailsPage.css";

type ProductDetailsPageProps = {
Expand Down Expand Up @@ -150,28 +152,14 @@ export default function ProductDetailsPage({
const difference = item.price - (cheapest?.price ?? item.price);

return (
<li
className={`store-price-row ${index === 0 ? "cheapest" : ""}`}
<PriceRow
key={item.storeCode}
>
<span className="store-number">
{String(index + 1).padStart(2, "0")}
</span>

<span className="store-name">
{getStoreName(item.storeCode)}
</span>

<span className="store-difference">
{index === 0
? "BILLIGST"
: `+${formatPrice(difference)} KR`}
</span>

<span className="store-price">
{item.price.toFixed(2).replace(".", ",")} kr
</span>
</li>
number={String(index + 1).padStart(2, "0")}
store={getStoreName(item.storeCode)}
price={`${formatPrice(item.price)} kr`}
difference={`+${formatPrice(difference)} KR`}
cheapest={index === 0}
/>
);
})}
</ol>
Expand All @@ -186,29 +174,16 @@ export default function ProductDetailsPage({
{isInList ? "Står på lappen din" : "Ikke på lappen din"}
</h2>
</header>
<section className="quantity-controls" aria-label="Antall">
<button
type="button"
aria-label="Reduser antall"
disabled={!isInList || quantity <= 1}
onClick={() => setQuantity((q) => Math.max(1, q - 1))}
>
−
</button>

<output aria-live="polite">{isInList ? quantity : 0}</output>

<button
type="button"
aria-label="Øk antall"
onClick={() => {
setQuantity((q) => (isInList ? q + 1 : 1));
setIsInList(true);
<QuantityStepper
className="quantity-controls"
value={isInList ? quantity : 0}
itemName={product.name}
onDecrease={() => setQuantity((q) => Math.max(1, q - 1))}
onIncrease={() => {
setQuantity((q) => (isInList ? q + 1 : 1));
setIsInList(true);
}}
>
+
</button>
</section>
/>



Expand Down