Skip to content

Commit d86e713

Browse files
committed
Font size and color fix for sale product
1 parent 7402aba commit d86e713

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

src/components/Product/DisplayProducts.component.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const DisplayProducts = ({ products }: IDisplayProductsProps) => (
108108
>
109109
<span>
110110
<div className="mt-4">
111-
<p className="text-base font-bold text-center cursor-pointer hover:text-gray-600 transition-colors">
111+
<p className="text-2xl font-bold text-center cursor-pointer hover:text-gray-600 transition-colors">
112112
{name}
113113
</p>
114114
</div>
@@ -117,17 +117,17 @@ const DisplayProducts = ({ products }: IDisplayProductsProps) => (
117117
<div className="mt-2 text-center">
118118
{onSale ? (
119119
<div className="flex justify-center items-center space-x-2">
120-
<span className="text-red-600">
120+
<span className="text-xl font-bold text-red-600">
121121
{variations && filteredVariantPrice(price, '')}
122122
{!variations && salePrice}
123123
</span>
124-
<span className="text-gray-500 text-sm line-through">
124+
<span className="text-lg text-gray-500 line-through">
125125
{variations && filteredVariantPrice(price, 'right')}
126126
{!variations && regularPrice}
127127
</span>
128128
</div>
129129
) : (
130-
<span className="text-gray-900">
130+
<span className="text-lg text-gray-900">
131131
{price}
132132
</span>
133133
)}

src/components/Product/ProductCard.component.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import Link from 'next/link';
22
import Image from 'next/image';
3+
import { paddedPrice } from '@/utils/functions/functions';
34

45
interface ProductCardProps {
56
databaseId: number;
67
name: string;
78
price: string;
9+
regularPrice: string;
10+
salePrice?: string;
11+
onSale: boolean;
812
slug: string;
913
image?: {
1014
sourceUrl?: string;
@@ -15,9 +19,17 @@ const ProductCard = ({
1519
databaseId,
1620
name,
1721
price,
22+
regularPrice,
23+
salePrice,
24+
onSale,
1825
slug,
1926
image,
2027
}: ProductCardProps) => {
28+
// Add padding/empty character after currency symbol
29+
const formattedPrice = price ? paddedPrice(price, 'kr') : price;
30+
const formattedRegularPrice = regularPrice ? paddedPrice(regularPrice, 'kr') : regularPrice;
31+
const formattedSalePrice = salePrice ? paddedPrice(salePrice, 'kr') : salePrice;
32+
2133
return (
2234
<div className="group">
2335
<div className="aspect-[3/4] overflow-hidden bg-gray-100 relative">
@@ -41,13 +53,20 @@ const ProductCard = ({
4153

4254
<Link href={`/produkt/${slug}?id=${databaseId}`}>
4355
<div className="mt-4">
44-
<p className="text-base font-bold text-center cursor-pointer hover:text-gray-600 transition-colors">
56+
<p className="text-2xl font-bold text-center cursor-pointer hover:text-gray-600 transition-colors">
4557
{name}
4658
</p>
4759
</div>
4860
</Link>
4961
<div className="mt-2 text-center">
50-
<span className="text-gray-900">{price}</span>
62+
{onSale ? (
63+
<div className="flex items-center justify-center gap-2">
64+
<span className="text-xl font-bold text-red-600">{formattedSalePrice}</span>
65+
<span className="text-lg text-gray-500 line-through">{formattedRegularPrice}</span>
66+
</div>
67+
) : (
68+
<span className="text-lg text-gray-900">{formattedPrice}</span>
69+
)}
5170
</div>
5271
</div>
5372
);

src/components/Product/ProductList.component.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ const ProductList = ({ products, title }: ProductListProps) => {
7171
databaseId={product.databaseId}
7272
name={product.name}
7373
price={product.price}
74+
regularPrice={product.regularPrice}
75+
salePrice={product.salePrice}
76+
onSale={product.onSale}
7477
slug={product.slug}
7578
image={product.image}
7679
/>

src/components/Product/SingleProduct.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const SingleProduct = ({ product }: IProductRootObject) => {
8383
<div className="text-center md:text-left mb-6">
8484
{onSale ? (
8585
<div className="flex flex-col md:flex-row items-center md:items-start gap-2">
86-
<p className="text-2xl font-bold text-gray-900">
86+
<p className="text-2xl font-bold text-red-600">
8787
{product.variations
8888
? filteredVariantPrice(price, '')
8989
: salePrice}

0 commit comments

Comments
 (0)