diff --git a/components/content/Promo/index.tsx b/components/content/Promo/index.tsx index 13d45a86..684577b5 100644 --- a/components/content/Promo/index.tsx +++ b/components/content/Promo/index.tsx @@ -35,7 +35,6 @@ export const Promo: FC = ({ {image && ( diff --git a/components/content/Publication/PublicationTeaser/index.tsx b/components/content/Publication/PublicationTeaser/index.tsx index 58b95fe9..2c5fb5d1 100644 --- a/components/content/Publication/PublicationTeaser/index.tsx +++ b/components/content/Publication/PublicationTeaser/index.tsx @@ -40,7 +40,6 @@ export const PublicationTeaser: FC = ({
diff --git a/components/content/blocks/MediaBlock/index.tsx b/components/content/blocks/MediaBlock/index.tsx index cfd9f27d..7778f02b 100644 --- a/components/content/blocks/MediaBlock/index.tsx +++ b/components/content/blocks/MediaBlock/index.tsx @@ -40,9 +40,8 @@ const renderMedia = (
{mediaDescription && (
diff --git a/components/content/blocks/QuoteBlock/index.tsx b/components/content/blocks/QuoteBlock/index.tsx index 2b03304b..7dcdaf2a 100644 --- a/components/content/blocks/QuoteBlock/index.tsx +++ b/components/content/blocks/QuoteBlock/index.tsx @@ -17,8 +17,7 @@ export const QuoteBlock: FC = ({ quote, author, image }) => {
{image && ( diff --git a/components/global/CustomImage/index.tsx b/components/global/CustomImage/index.tsx index db85c9d7..21f8383e 100644 --- a/components/global/CustomImage/index.tsx +++ b/components/global/CustomImage/index.tsx @@ -10,18 +10,19 @@ interface CustomImageProps { sizes?: string; className?: string; priority?: boolean; - width?: number; } const isNextStatic = (url: string) => typeof url != "string" || !url.startsWith("/uploads"); +const imageSizes = ["thumbnail", "small", "medium", "large"]; +const imageWidths = ["248w", "500w", "750w", "1000w"]; + export const CustomImage: FC = ({ image, sizes, className, priority = false, - width, }) => { if (!image) { return ( @@ -56,20 +57,37 @@ export const CustomImage: FC = ({ ); } - const src = isExternalLink(image.url) - ? image.url - : (env("MEDIA_BASE_URL") || "") + image.url; + const src = isExternalLink(image.url); + + const srcset = imageSizes + .map( + (w, idx: number) => + `${ + src + ? image.url + : (env("MEDIA_BASE_URL") || "") + + image.url.replace("uploads/", "uploads/" + w + "_") + + " " + + imageWidths[idx] + }`, + ) + .join(", "); return ( - {image.alt + + + {image.alt + ); }; diff --git a/components/global/Typography/HtmlParser/index.tsx b/components/global/Typography/HtmlParser/index.tsx index 415aeb46..c13639b4 100644 --- a/components/global/Typography/HtmlParser/index.tsx +++ b/components/global/Typography/HtmlParser/index.tsx @@ -47,7 +47,6 @@ export const HtmlParser: FC<{ text: string }> = ({ text }) => { return ( ); diff --git a/components/layout/Hero/index.tsx b/components/layout/Hero/index.tsx index 37055faf..0b7917d8 100644 --- a/components/layout/Hero/index.tsx +++ b/components/layout/Hero/index.tsx @@ -47,7 +47,6 @@ export const Hero: FC = ({ {image && (