diff --git a/storefront/components/Basic/Icon/IconImage.tsx b/storefront/components/Basic/Icon/IconImage.tsx index e2ffe078fd..c2743edab8 100644 --- a/storefront/components/Basic/Icon/IconImage.tsx +++ b/storefront/components/Basic/Icon/IconImage.tsx @@ -1,3 +1,4 @@ +import { Image } from 'components/Basic/Image/Image'; import { HTMLAttributes } from 'react'; import { ExtractNativePropsFromDefault } from 'types/ExtractNativePropsFromDefault'; @@ -5,14 +6,14 @@ type NativeProps = ExtractNativePropsFromDefault, ne type IconImageProps = NativeProps & { icon: string; - alt: string | undefined; + alt: string; width?: number; height?: number; }; export const IconImage: FC = ({ icon, height, width, ...props }) => { return ( - ['loading']; - width?: string | number; - height?: string | number; - wrapperClassName?: string; -}; - -const getDataTestId = (dataTestId?: string) => dataTestId ?? 'basic-image'; - -export const Image: FC = ({ - image, - alt, - loading, - dataTestId, - width, - height, - className, - wrapperClassName, -}) => { - const imageTwClass = twMergeCustom( - 'object-contain [image-rendering:-webkit-optimize-contrast] max-w-full max-h-full mx-auto', - className, - ); + src: NextImageProps['src'] | undefined | null; +} & Omit; - if (!image) { - return ( -
- {alt -
- ); - } +export const Image: FC = ({ src, className, ...props }) => { + const [imageUrl, setImageUrl] = useState(src ?? '/images/optimized-noimage.webp'); return ( - - {image.name - + `${src}?width=${width || '0'}`} + src={imageUrl} + onError={() => setImageUrl('/images/optimized-noimage.webp')} + {...props} + /> ); }; diff --git a/storefront/components/Blocks/Adverts/Adverts.tsx b/storefront/components/Blocks/Adverts/Adverts.tsx index d025a132f8..46214e71aa 100644 --- a/storefront/components/Blocks/Adverts/Adverts.tsx +++ b/storefront/components/Blocks/Adverts/Adverts.tsx @@ -1,4 +1,5 @@ import { ExtendedNextLink } from 'components/Basic/ExtendedNextLink/ExtendedNextLink'; +import { Image } from 'components/Basic/Image/Image'; import { Webline } from 'components/Layout/Webline/Webline'; import { AdvertsFragmentApi, CategoryDetailFragmentApi, useAdvertsQueryApi } from 'graphql/generated'; import { Fragment } from 'react'; @@ -50,15 +51,22 @@ export const Adverts: FC = ({ const mainImageMobile = advert.mainImageMobile; const ImageComponent = ( - - {/* use min-width equal to Tailwind "lg" breakpoint */} - - {advert.mainImage?.name + {mainImage?.name + {mainImageMobile?.name - + ); return ( diff --git a/storefront/components/Blocks/Banners/BannersSliderItem.tsx b/storefront/components/Blocks/Banners/BannersSliderItem.tsx index 6d66941489..1a68886525 100644 --- a/storefront/components/Blocks/Banners/BannersSliderItem.tsx +++ b/storefront/components/Blocks/Banners/BannersSliderItem.tsx @@ -1,3 +1,4 @@ +import { Image } from 'components/Basic/Image/Image'; import { SliderItemFragmentApi } from 'graphql/generated'; type BannersSliderItemProps = { @@ -16,14 +17,19 @@ export const BannersSliderItem: FC = ({ {!image ? ( ) : ( - - - + )} ); }; const BannerImage: FC<{ src: string; alt: string }> = ({ src, alt }) => ( - {alt} + {alt} ); diff --git a/storefront/components/Blocks/BlogPreview/BlogPreviewMain.tsx b/storefront/components/Blocks/BlogPreview/BlogPreviewMain.tsx index d36b873252..186b019c8a 100644 --- a/storefront/components/Blocks/BlogPreview/BlogPreviewMain.tsx +++ b/storefront/components/Blocks/BlogPreview/BlogPreviewMain.tsx @@ -21,8 +21,11 @@ export const BlogPreviewMain: FC = ({ articles }) => ( > {article.mainImage?.name diff --git a/storefront/components/Blocks/BlogPreview/BlogPreviewSide.tsx b/storefront/components/Blocks/BlogPreview/BlogPreviewSide.tsx index 9447c80e4c..302acff765 100644 --- a/storefront/components/Blocks/BlogPreview/BlogPreviewSide.tsx +++ b/storefront/components/Blocks/BlogPreview/BlogPreviewSide.tsx @@ -16,7 +16,10 @@ export const BlogPreviewSide: FC = ({ articles }) => ( {article.mainImage?.name diff --git a/storefront/components/Blocks/ConfirmationPage/ConfirmationPageContent.tsx b/storefront/components/Blocks/ConfirmationPage/ConfirmationPageContent.tsx index 5a2ea63776..55d7cc89e7 100644 --- a/storefront/components/Blocks/ConfirmationPage/ConfirmationPageContent.tsx +++ b/storefront/components/Blocks/ConfirmationPage/ConfirmationPageContent.tsx @@ -1,3 +1,5 @@ +import sentCartImage from '/public/images/sent-cart.svg'; +import { Image } from 'components/Basic/Image/Image'; import { SkeletonPageConfirmation } from 'components/Blocks/Skeleton/SkeletonPageConfirmation'; import { ReactElement } from 'react'; @@ -21,7 +23,7 @@ export const ConfirmationPageContent: FC = ({ return (
- {heading} + {heading}
{heading}
diff --git a/storefront/components/Blocks/OrderSummary/SingleProduct.tsx b/storefront/components/Blocks/OrderSummary/SingleProduct.tsx index f442e174dd..3af3e93aff 100644 --- a/storefront/components/Blocks/OrderSummary/SingleProduct.tsx +++ b/storefront/components/Blocks/OrderSummary/SingleProduct.tsx @@ -14,11 +14,15 @@ export const SingleProduct: FC = ({ item }) => { return (
  • - {item.product.mainImage?.name +
    + {item.product.mainImage?.name +
    diff --git a/storefront/components/Blocks/OrderSummary/TransportAndPayment.tsx b/storefront/components/Blocks/OrderSummary/TransportAndPayment.tsx index c12be4b573..a39f4a2d38 100644 --- a/storefront/components/Blocks/OrderSummary/TransportAndPayment.tsx +++ b/storefront/components/Blocks/OrderSummary/TransportAndPayment.tsx @@ -32,9 +32,9 @@ export const TransportAndPayment: FC = ({ payment, tra {transport.name} - - {transport.name} - +
    + {transport.name} +
    {formatPrice(transport.price.priceWithVat)} @@ -45,9 +45,9 @@ export const TransportAndPayment: FC = ({ payment, tra {payment.name} - - {payment.name} - +
    + {payment.name} +
    {formatPrice(payment.price.priceWithVat)} diff --git a/storefront/components/Blocks/Product/AddToCartPopup.tsx b/storefront/components/Blocks/Product/AddToCartPopup.tsx index c818fe02c4..e1851fa4e2 100644 --- a/storefront/components/Blocks/Product/AddToCartPopup.tsx +++ b/storefront/components/Blocks/Product/AddToCartPopup.tsx @@ -39,7 +39,13 @@ export const AddToCartPopup: FC = ({ onCloseCallback, added > {!!product.mainImage && (
    - {product.mainImage.name + {product.mainImage.name
    )}
    diff --git a/storefront/components/Blocks/Product/ProductsList/ProductListItem.tsx b/storefront/components/Blocks/Product/ProductsList/ProductListItem.tsx index dd6fc62373..2de5e3a3e8 100644 --- a/storefront/components/Blocks/Product/ProductsList/ProductListItem.tsx +++ b/storefront/components/Blocks/Product/ProductsList/ProductListItem.tsx @@ -77,8 +77,10 @@ export const ProductListItem = forwardRef(
    {product.mainImage?.name {!!product.flags.length && (
    diff --git a/storefront/components/Blocks/SimpleNavigation/SimpleNavigationListItem.tsx b/storefront/components/Blocks/SimpleNavigation/SimpleNavigationListItem.tsx index 5e8e979ff1..6429488bbc 100644 --- a/storefront/components/Blocks/SimpleNavigation/SimpleNavigationListItem.tsx +++ b/storefront/components/Blocks/SimpleNavigation/SimpleNavigationListItem.tsx @@ -32,16 +32,19 @@ export const SimpleNavigationListItem: FC = ({ )} > {itemImage && ( - {itemImage.name +
    + {itemImage.name +
    )} -
    - {listedItem.name} +
    +
    {listedItem.name}
    {'totalCount' in listedItem && listedItem.totalCount !== undefined && ( ({listedItem.totalCount}) )} diff --git a/storefront/components/Forms/TextInput/PasswordInputControlled.tsx b/storefront/components/Forms/TextInput/PasswordInputControlled.tsx index 3cd3e4b258..cd764d97a3 100644 --- a/storefront/components/Forms/TextInput/PasswordInputControlled.tsx +++ b/storefront/components/Forms/TextInput/PasswordInputControlled.tsx @@ -1,4 +1,6 @@ import { TextInput } from './TextInput'; +import eyeIcon from '/public/svg/eye.svg'; +import { Image } from 'components/Basic/Image/Image'; import { FormLineError } from 'components/Forms/Lib/FormLineError'; import { InputHTMLAttributes, ReactElement, useCallback, useState } from 'react'; import { Control, useController } from 'react-hook-form'; @@ -56,9 +58,9 @@ export const PasswordInputControlled: FC = ({ onBlur={field.onBlur} onChange={field.onChange} > - eye icon { return (
    - - - {t('Need - + {t('Need
    {t('Need advice?')} diff --git a/storefront/components/Layout/Footer/FooterCopyright.tsx b/storefront/components/Layout/Footer/FooterCopyright.tsx index 20a041e6c6..984cc84e4d 100644 --- a/storefront/components/Layout/Footer/FooterCopyright.tsx +++ b/storefront/components/Layout/Footer/FooterCopyright.tsx @@ -1,5 +1,6 @@ +import imageLogo from '/public/images/logo.svg'; +import { Image } from 'components/Basic/Image/Image'; import useTranslation from 'next-translate/useTranslation'; -import Image from 'next/image'; const TEST_IDENTIFIER = 'layout-footer-footercopyright'; @@ -14,7 +15,7 @@ export const FooterCopyright: FC = () => {
    {t('Customized E-shop by')} - footer logo + footer logo
    diff --git a/storefront/components/Layout/Header/AutocompleteSearch/AutocompleteSearchPopup.tsx b/storefront/components/Layout/Header/AutocompleteSearch/AutocompleteSearchPopup.tsx index 74632ad03d..6a27418b16 100644 --- a/storefront/components/Layout/Header/AutocompleteSearch/AutocompleteSearchPopup.tsx +++ b/storefront/components/Layout/Header/AutocompleteSearch/AutocompleteSearchPopup.tsx @@ -32,8 +32,6 @@ type AutocompleteProps = { const TEST_IDENTIFIER = 'layout-header-search-autocomplete-popup'; -const imageTwClass = 'lg:w-full'; - export const AutocompleteSearchPopup: FC = ({ autocompleteSearchQueryValue, autocompleteSearchResults: { articlesSearch, brandSearch, categoriesSearch, productsSearch }, @@ -120,9 +118,10 @@ export const AutocompleteSearchPopup: FC = ({ > {product.mainImage?.name {product.fullName} diff --git a/storefront/components/Layout/Header/Cart/CartListItem.tsx b/storefront/components/Layout/Header/Cart/CartListItem.tsx index bcbee1de29..289637b9ab 100644 --- a/storefront/components/Layout/Header/Cart/CartListItem.tsx +++ b/storefront/components/Layout/Header/Cart/CartListItem.tsx @@ -23,7 +23,15 @@ export const ListItem: FC = ({ cartItem: { product, uuid, quantit className="flex w-full items-center gap-x-3 border-b border-greyLighter py-3" data-testid={TEST_IDENTIFIER} > - {product.mainImage?.name +
    + {product.mainImage?.name +
    ( <> - diff --git a/storefront/components/Layout/Header/Navigation/NavigationItemColumn.tsx b/storefront/components/Layout/Header/Navigation/NavigationItemColumn.tsx index e2e5af4e79..4a33c2efc7 100644 --- a/storefront/components/Layout/Header/Navigation/NavigationItemColumn.tsx +++ b/storefront/components/Layout/Header/Navigation/NavigationItemColumn.tsx @@ -21,8 +21,10 @@ export const NavigationItemColumn: FC = ({ columnCate > {columnCategory.mainImage?.name diff --git a/storefront/components/Layout/NotificationBars/NotificationBars.tsx b/storefront/components/Layout/NotificationBars/NotificationBars.tsx index 3e0a8ffead..429502dca5 100644 --- a/storefront/components/Layout/NotificationBars/NotificationBars.tsx +++ b/storefront/components/Layout/NotificationBars/NotificationBars.tsx @@ -45,8 +45,9 @@ export const NotificationBars: FC = memo(function NotificationBars() {
    {item.mainImage.name
    )} diff --git a/storefront/components/Pages/BlogArticle/BlogArticleDetailContent.tsx b/storefront/components/Pages/BlogArticle/BlogArticleDetailContent.tsx index 637b83943b..f1c531bb40 100644 --- a/storefront/components/Pages/BlogArticle/BlogArticleDetailContent.tsx +++ b/storefront/components/Pages/BlogArticle/BlogArticleDetailContent.tsx @@ -19,7 +19,13 @@ export const BlogArticleDetailContent: FC = ({ bl
    {blogArticle.mainImage && (
    - {blogArticle.mainImage.name + {blogArticle.mainImage.name
    )} diff --git a/storefront/components/Pages/BlogCategory/BlogArticlesList.tsx b/storefront/components/Pages/BlogCategory/BlogArticlesList.tsx index 2534f355b8..02d19d07c9 100644 --- a/storefront/components/Pages/BlogCategory/BlogArticlesList.tsx +++ b/storefront/components/Pages/BlogCategory/BlogArticlesList.tsx @@ -15,17 +15,20 @@ export const BlogArticlesList: FC = ({ blogArticles }) => return (