Skip to content

Commit 3c8998e

Browse files
committed
style: product page responsiviness
1 parent 04dfbbd commit 3c8998e

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

components/product/gallery.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function Gallery({ images, options, title }: GalleryProps) {
3232
const imageIndex = imageSearchParam ? parseInt(imageSearchParam) : 0
3333

3434
return (
35-
<div className="relative flex h-max w-full max-w-[700px] flex-col items-center justify-center border border-black p-10">
35+
<div className="relative flex h-max w-full max-w-[700px] flex-col items-center justify-center border border-black p-10 tablet:p-4">
3636
<div className="relative aspect-[700/600] w-full">
3737
<Image
3838
src={productImages[imageIndex >= productImages.length || imageIndex < 0 ? 0 : imageIndex].url}
@@ -43,7 +43,7 @@ export function Gallery({ images, options, title }: GalleryProps) {
4343
/>
4444
</div>
4545
{productImages.length > 1 && (
46-
<ul className="mt-6 flex gap-5">
46+
<ul className="mt-6 flex gap-2">
4747
{productImages?.map((image, index) => {
4848
const isActive = index === imageIndex
4949
const imageSearchParams = new URLSearchParams(searchParams.toString())

components/product/price.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function Price({ amount, variants, options }: PriceProps) {
4343

4444
return (
4545
<div>
46-
<span className="text-3xl font-bold">{formatPriceToBrl(price)}</span>
46+
<span className="text-3xl font-bold tablet:text-xl">{formatPriceToBrl(price)}</span>
4747
</div>
4848
)
4949
}

components/product/product.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ export async function Product({ handle }: ProductProps) {
2222
const options = product.options
2323

2424
return (
25-
<div className="relative flex h-max w-full gap-2">
25+
<div className="relative flex h-max w-full gap-2 tablet:flex-col">
2626
<Gallery images={images} options={options} title={product.title} />
27-
<div className="flex aspect-[700/600] w-full max-w-[600px] flex-col justify-between border border-black bg-white p-5">
27+
<div className="flex aspect-[700/600] w-full max-w-[600px] flex-col justify-between border border-black bg-white p-5 tablet:aspect-auto tablet:max-w-full tablet:gap-10">
2828
<div>
2929
<div className="flex flex-col gap-2">
30-
<span className="text-3xl">{product.title}</span>
30+
<span className="text-3xl tablet:text-xl">{product.title}</span>
3131
<Price amount={price} variants={variants} options={options} />
3232
</div>
33+
3334
<VariantSelector variants={variants} options={options} />
3435
<Description />
3536
</div>

components/product/variant-selector.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export function VariantSelector({ options, variants }: VariantSelectorProps) {
3838
return (
3939
<div key={option.id}>
4040
<div className="flex flex-col gap-2">
41-
<span className="text-sm">{option.name.toLocaleUpperCase()}</span>
42-
<ul className="flex gap-4">
41+
<span className="text-sm mobile:text-xs">{option.name.toLocaleUpperCase()}</span>
42+
<ul className="flex flex-wrap gap-4">
4343
{option.values.map((value) => {
4444
const optionNameLowerCase = option.name.toLocaleLowerCase()
4545
const optionSearchParams = new URLSearchParams(searchParams.toString())
@@ -63,7 +63,7 @@ export function VariantSelector({ options, variants }: VariantSelectorProps) {
6363
href={optionUrl}
6464
aria-disabled={!isAvailableForSale}
6565
data-active={isActive}
66-
className={cn('w-max border border-black px-2 py-1 text-sm', {
66+
className={cn('w-max border border-black px-2 py-1 text-xs', {
6767
'cursor-default bg-black text-white': isActive,
6868
'hover:bg-neutral-200': !isActive && isAvailableForSale,
6969
'pointer-events-none border-neutral-400 bg-neutral-200 text-neutral-400': !isAvailableForSale,

0 commit comments

Comments
 (0)