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: ThirdBanners component created
- Loading branch information
1 parent
bb6021a
commit 7c635e2
Showing
3 changed files
with
132 additions
and
54 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,75 @@ | ||
import Image from "apps/website/components/Image.tsx"; | ||
import type { HTMLWidget, ImageWidget } from "apps/admin/widgets.ts"; | ||
|
||
/** | ||
* @altBy title | ||
*/ | ||
export interface Banner { | ||
image: ImageWidget; | ||
alt: string; | ||
title: string; | ||
description: HTMLWidget; | ||
/** | ||
* @default # | ||
*/ | ||
link: string; | ||
target?: "_blank" | "_self"; | ||
} | ||
|
||
export interface Props { | ||
title?: HTMLWidget; | ||
/** | ||
* @minItems 3 | ||
* @maxItems 3 | ||
*/ | ||
banners?: Banner[]; | ||
} | ||
|
||
function BannerCard( | ||
{ image, alt, title, description, link = "#", target = "_blank" }: Banner, | ||
) { | ||
return ( | ||
<div class="flex flex-col items-center justify-center gap-6 w-full h-full"> | ||
<a | ||
href={link} | ||
target={target} | ||
> | ||
<Image | ||
src={image} | ||
width={423} | ||
height={321} | ||
alt={alt} | ||
loading="lazy" | ||
fetchPriority="low" | ||
/> | ||
</a> | ||
|
||
<div class="flex flex-col gap-2 items-center justify-center"> | ||
<h2 class="leading-5 font-bold text-center">{title}</h2> | ||
{description && ( | ||
<div | ||
class="text-center leading-4 text-sm max-w-[75%]" | ||
dangerouslySetInnerHTML={{ __html: description }} | ||
/> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default function ThirdBanners({ banners = [], title }: Props) { | ||
return ( | ||
<div class="w-full container py-8 flex flex-col gap-10 lg:py-10 max-w-[95%] xl:max-w-[80%] 2xl:max-w-[1350px]"> | ||
{title && ( | ||
<div | ||
class="leading-[18px] lg:text-[26px] lg:leading-[30px] text-nowrap" | ||
dangerouslySetInnerHTML={{ __html: title }} | ||
/> | ||
)} | ||
|
||
<div class="grid lg:grid-cols-3 gap-6 xl:gap-4 w-full"> | ||
{banners.map((banner) => <BannerCard {...banner} />)} | ||
</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/ThirdBanners.tsx"; |