Skip to content

Commit

Permalink
Changing img tag (#120)
Browse files Browse the repository at this point in the history
* Changing img tag

* Removing all img tags

---------

Co-authored-by: Vinicius Ribeiro <[email protected]>
  • Loading branch information
viniciustrr and Vinicius Ribeiro authored Jan 25, 2024
1 parent d8ac47c commit 3891391
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 15 deletions.
16 changes: 14 additions & 2 deletions components/daisy/Diff.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Image from "apps/website/components/Image.tsx";

export interface Props {
oldImage: { src: string; alt: string };
newImage: { src: string; alt: string };
Expand All @@ -9,10 +11,20 @@ export default function Diff(props: Props) {
return (
<div class="diff aspect-[16/9]">
<div className="diff-item-1">
<img alt={oldImage.alt} src={oldImage.src} />
<Image
alt={oldImage.alt}
src={oldImage.src}
width={1080}
height={720}
/>
</div>
<div className="diff-item-2">
<img alt={newImage.alt} src={newImage.src} />
<Image
alt={newImage.alt}
src={newImage.src}
width={1080}
height={720}
/>
</div>
<div className="diff-resizer"></div>
</div>
Expand Down
10 changes: 8 additions & 2 deletions components/daisy/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Image from "apps/website/components/Image.tsx";

export interface Props {
title: string;
description: string;
Expand All @@ -17,10 +19,12 @@ export default function Hero(props: Props) {
: "hero-content text-center"}
>
{image && !imageOnRight && (
<img
<Image
src={image.src}
className="max-w-sm rounded-lg shadow-2xl"
alt={image.alt}
width={1080}
height={1350}
/>
)}
<div className={image ? "" : "max-w-md"}>
Expand All @@ -33,10 +37,12 @@ export default function Hero(props: Props) {
)}
</div>
{image && imageOnRight && (
<img
<Image
src={image.src}
className="max-w-sm rounded-lg shadow-2xl"
alt={image.alt}
width={1080}
height={1350}
/>
)}
</div>
Expand Down
6 changes: 5 additions & 1 deletion components/daisy/Indicator.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Image from "apps/website/components/Image.tsx";

export interface Props {
text?: string;
badgeText?: string;
Expand All @@ -18,7 +20,9 @@ export default function Indicator(props: Props) {
}`}
>
{!avatar && text}
{avatar && <img alt={avatar.alt} src={avatar.src} />}
{avatar && (
<Image alt={avatar.alt} src={avatar.src} width={80} height={80} />
)}
</div>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion components/footer/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ImageWidget } from "apps/admin/widgets.ts";
import Image from "apps/website/components/Image.tsx";

export interface Props {
logo?: {
Expand All @@ -13,7 +14,7 @@ export default function Logo({ logo }: Props) {
{logo?.image && (
<div class="flex flex-col gap-3">
<div class="w-28 max-h-16">
<img
<Image
loading="lazy"
src={logo?.image}
alt={logo?.description}
Expand Down
6 changes: 4 additions & 2 deletions components/ui/BannerCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SliderJS from "$store/islands/SliderJS.tsx";
import { useId } from "$store/sdk/useId.ts";
import type { ImageWidget } from "apps/admin/widgets.ts";
import { Picture, Source } from "apps/website/components/Picture.tsx";
import Image from "apps/website/components/Image.tsx";

/**
* @titleBy alt
Expand Down Expand Up @@ -148,11 +149,13 @@ function BannerItem(
width={1440}
height={600}
/>
<img
<Image
class="object-cover w-full h-full"
loading={lcp ? "eager" : "lazy"}
src={desktop}
alt={alt}
width={1440}
height={600}
/>
</Picture>
</a>
Expand Down Expand Up @@ -230,7 +233,6 @@ function BannerCarousel(props: Props) {
<Slider class="carousel carousel-center w-full col-span-full row-span-full gap-6">
{images?.map((image, index) => {
const params = { promotion_name: image.alt };

return (
<Slider.Item index={index} class="carousel-item w-full">
<BannerItem
Expand Down
5 changes: 4 additions & 1 deletion components/ui/BannerGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Picture, Source } from "apps/website/components/Picture.tsx";
import type { ImageWidget } from "apps/admin/widgets.ts";
import Image from "apps/website/components/Image.tsx";

/**
* @titleBy alt
Expand Down Expand Up @@ -160,13 +161,15 @@ export default function BannnerGrid(props: Props) {
width={250}
height={250}
/>
<img
<Image
class="w-full"
sizes="(max-width: 640px) 100vw, 30vw"
src={srcMobile}
alt={alt}
decoding="async"
loading="lazy"
width={100}
height={100}
/>
</Picture>
</a>
Expand Down
9 changes: 8 additions & 1 deletion components/ui/CategoryBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Picture, Source } from "apps/website/components/Picture.tsx";
import type { SectionProps } from "deco/types.ts";
import type { ImageWidget } from "apps/admin/widgets.ts";
import Image from "apps/website/components/Image.tsx";

/**
* @titleBy matcher
Expand Down Expand Up @@ -63,7 +64,13 @@ function Banner(props: SectionProps<ReturnType<typeof loader>>) {
height={200}
media="(min-width: 767px)"
/>
<img class="w-full" src={image.desktop} alt={image.alt ?? title} />
<Image
class="w-full"
src={image.desktop}
alt={image.alt ?? title}
width={1440}
height={200}
/>
</Picture>

<div class="container flex flex-col items-center justify-center sm:items-start col-start-1 col-span-1 row-start-1 row-span-1 w-full">
Expand Down
17 changes: 13 additions & 4 deletions components/ui/ImageGallery.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ImageWidget } from "apps/admin/widgets.ts";
import Image from "apps/website/components/Image.tsx";

/**
* @titleBy title
Expand Down Expand Up @@ -44,25 +45,33 @@ export default function ImageGallery({
{description}
</p>
<div class="grid grid-cols-2 gap-4 mt-11 lg:flex lg:gap-8 lg:mt-20">
<img
<Image
class="min-w-full object-cover max-w-[156px] max-h-[156px] "
src={imageOne}
alt={alt}
width={156}
height={156}
/>
<img
<Image
class="min-w-full object-cover max-w-[156px] max-h-[156px] "
src={imageTwo}
alt={alt}
width={156}
height={156}
/>
<img
<Image
class="min-w-full object-cover max-w-[156px] max-h-[156px] "
src={imageThree}
alt={alt}
width={156}
height={156}
/>
<img
<Image
class="min-w-full object-cover max-w-[156px] max-h-[156px] "
src={imageFour}
alt={alt}
width={156}
height={156}
/>
</div>
</section>
Expand Down
5 changes: 4 additions & 1 deletion sections/Images/ShoppableBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Picture, Source } from "apps/website/components/Picture.tsx";
import type { ImageWidget } from "apps/admin/widgets.ts";
import Image from "apps/website/components/Image.tsx";

export interface Props {
image: {
Expand Down Expand Up @@ -92,13 +93,15 @@ export default function ShoppableBanner(props: Props) {
width={384}
height={227}
/>
<img
<Image
class="w-full h-full object-cover"
sizes="(max-width: 640px) 100vw, 30vw"
src={image?.mobile}
alt={image?.altText}
decoding="async"
loading="lazy"
width={150}
height={150}
/>
</Picture>
{pins?.map(({ mobile, desktop, link, label }) => (
Expand Down

0 comments on commit 3891391

Please sign in to comment.