@@ -48,7 +48,7 @@ const SingleProduct = ({ product }: IProductRootObject) => {
48
48
}
49
49
50
50
return (
51
- < section className = "py-8 bg-white mb-12 sm:mb-2" >
51
+ < section className = "bg-white mb-12 sm:mb-2" >
52
52
{ /* Show loading spinner while loading, and hide content while loading */ }
53
53
{ isLoading ? (
54
54
< div className = "h-56 mt-20" >
@@ -57,66 +57,63 @@ const SingleProduct = ({ product }: IProductRootObject) => {
57
57
< LoadingSpinner />
58
58
</ div >
59
59
) : (
60
- < div className = "container flex flex-wrap items-center pt-4 pb-12 mx-auto " >
61
- < div className = "grid grid-cols-1 gap-4 mt-16 lg:grid-cols-2 xl:grid-cols-2 md:grid-cols-2 sm:grid-cols-2 " >
60
+ < div className = "container mx-auto px-4 sm:px-6 lg:px-8 " >
61
+ < div className = "grid grid-cols-1 gap-4 md:grid-cols-2 lg:gap-8 " >
62
62
{ image && (
63
- < img
64
- id = "product-image"
65
- src = { image . sourceUrl }
66
- alt = { name }
67
- className = "h-auto p-8 transition duration-500 ease-in-out transform xl:p-2 md:p-2 lg:p-2 md:hover:grow md:hover:scale-105"
68
- />
63
+ < div className = "flex justify-center items-center" >
64
+ < img
65
+ id = "product-image"
66
+ src = { image . sourceUrl }
67
+ alt = { name }
68
+ className = "max-w-full h-auto transition duration-500 ease-in-out transform hover:scale-105"
69
+ />
70
+ </ div >
69
71
) }
70
72
{ ! image && (
71
- < img
72
- id = "product-image"
73
- src = {
74
- process . env . NEXT_PUBLIC_PLACEHOLDER_LARGE_IMAGE_URL ??
75
- placeholderFallBack
76
- }
77
- alt = { name }
78
- className = "h-auto p-8 transition duration-500 ease-in-out transform xl:p-2 md:p-2 lg:p-2 md:hover:grow md:hover:shadow-lg md:hover:scale-105"
79
- />
73
+ < div className = "flex justify-center items-center" >
74
+ < img
75
+ id = "product-image"
76
+ src = {
77
+ process . env . NEXT_PUBLIC_PLACEHOLDER_LARGE_IMAGE_URL ??
78
+ placeholderFallBack
79
+ }
80
+ alt = { name }
81
+ className = "max-w-full h-auto transition duration-500 ease-in-out transform hover:scale-105"
82
+ />
83
+ </ div >
80
84
) }
81
- < div className = "ml-8" >
82
- < p className = "text-3xl font-bold text-left" > { name } </ p >
83
- < br />
85
+ < div className = "flex flex-col justify-center text-center md:text-left" >
86
+ < h1 className = "text-3xl font-bold mb-4" > { name } </ h1 >
84
87
{ /* Display sale price when on sale */ }
85
88
{ onSale && (
86
- < div className = "flex" >
87
- < p className = "pt-1 mt-4 text-3xl text-gray-900 " >
89
+ < div className = "flex flex-col md:flex-row items-center md:items-start justify-center md:justify-start mb-4 " >
90
+ < p className = "text-3xl font-bold text-red-600 mr-4 " >
88
91
{ product . variations && filteredVariantPrice ( price , '' ) }
89
92
{ ! product . variations && salePrice }
90
93
</ p >
91
- < p className = "pt-1 pl-8 mt-4 text-2xl text-gray-900 line-through" >
94
+ < p className = "text-2xl text-gray-500 line-through" >
92
95
{ product . variations && filteredVariantPrice ( price , 'right' ) }
93
96
{ ! product . variations && regularPrice }
94
97
</ p >
95
98
</ div >
96
99
) }
97
100
{ /* Display regular price when not on sale */ }
98
101
{ ! onSale && (
99
- < p className = "pt-1 mt-4 text-2xl text-gray-900" > { price } </ p >
102
+ < p className = "text-3xl font-bold mb-4" > { price } </ p >
100
103
) }
101
- < br />
102
- < p className = "pt-1 mt-4 text-2xl text-gray-900" >
103
- { DESCRIPTION_WITHOUT_HTML }
104
- </ p >
104
+ < p className = "text-lg mb-4" > { DESCRIPTION_WITHOUT_HTML } </ p >
105
105
{ Boolean ( product . stockQuantity ) && (
106
- < p
107
- v-if = "data.product.stockQuantity"
108
- className = "pt-1 mt-4 mb-4 text-2xl text-gray-900"
109
- >
106
+ < p className = "text-lg mb-4" >
110
107
{ product . stockQuantity } på lager
111
108
</ p >
112
109
) }
113
110
{ product . variations && (
114
- < p className = "pt-1 mt-4 text-xl text-gray-900 " >
115
- < span className = "py- 2" > Varianter</ span >
111
+ < div className = "mb-4 " >
112
+ < label htmlFor = "variant" className = "block text-lg mb- 2" > Varianter</ label >
116
113
< select
117
114
id = "variant"
118
115
name = "variant"
119
- className = "block w-80 px-6 py-2 bg-white border border-gray-500 rounded-lg focus:outline-none focus:shadow-outline "
116
+ className = "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 "
120
117
onChange = { ( e ) => {
121
118
setSelectedVariation ( Number ( e . target . value ) ) ;
122
119
} }
@@ -133,13 +130,9 @@ const SingleProduct = ({ product }: IProductRootObject) => {
133
130
} ,
134
131
) }
135
132
</ select >
136
- </ p >
133
+ </ div >
137
134
) }
138
- < div className = "pt-1 mt-2" >
139
- {
140
- // Display default AddToCart button if we do not have variations.
141
- // If we do, send the variationId to AddToCart button
142
- }
135
+ < div className = "flex justify-center md:justify-start" >
143
136
{ product . variations && (
144
137
< AddToCart
145
138
product = { product }
0 commit comments