generated from deco-sites/storefront
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ProductCategories component created and ShelfWithImage refactored
- Loading branch information
1 parent
7c635e2
commit 568469e
Showing
4 changed files
with
153 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import Image from "apps/website/components/Image.tsx"; | ||
import type { HTMLWidget, ImageWidget } from "apps/admin/widgets.ts"; | ||
|
||
export interface Props { | ||
title: HTMLWidget; | ||
/** @format color-input */ | ||
backgroundColor?: string; | ||
categories?: Array< | ||
{ | ||
icon: ImageWidget; | ||
label: string; | ||
link: string; | ||
description: string; | ||
width?: number; | ||
height?: number; | ||
} | ||
>; | ||
} | ||
|
||
export default function ProductCategories( | ||
{ title, categories, backgroundColor }: Props, | ||
) { | ||
return ( | ||
<div | ||
style={{ backgroundColor }} | ||
class="flex items-center justify-center w-full h-full" | ||
> | ||
<div class="flex flex-col lg:flex-row lg:items-center justify-between container max-w-[95%] lg:max-w-[1350px] px-4 gap-6 py-6"> | ||
<div | ||
class="leading-[18px] lg:text-[26px] lg:leading-[30px] text-nowrap" | ||
dangerouslySetInnerHTML={{ __html: title }} | ||
/> | ||
|
||
<div class="flex flex-row w-full items-center lg:justify-center gap-6 overflow-x-auto lg:overflow-hidden scrollbar pb-4"> | ||
{categories?.map(( | ||
{ icon, label, link, description, width, height }, | ||
) => ( | ||
<a | ||
href={link} | ||
aria-label={description ?? label} | ||
class="flex flex-col gap-3 items-center justify-center text-center w-[139px] h-full max-h-[168px] cursor-pointer" | ||
> | ||
<Image | ||
src={icon} | ||
alt={description} | ||
width={width || 139} | ||
height={height || 139} | ||
loading="lazy" | ||
class="object-cover rounded-full" | ||
/> | ||
|
||
<span class="text-sm leading-4 text-black-neutral truncate"> | ||
{label} | ||
</span> | ||
</a> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "$store/components/ui/ProductCategories.tsx"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters