Skip to content

Commit

Permalink
[project-base] [SSP-2610] comparison and wishlist icon changes (#3360)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebaholesz authored Aug 20, 2024
2 parents 35e8da8 + 8f48285 commit dd2034b
Show file tree
Hide file tree
Showing 98 changed files with 32 additions and 35 deletions.
29 changes: 4 additions & 25 deletions storefront/components/Basic/Icon/CompareIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
export const CompareIcon: SvgFC = (props) => (
<svg {...props} viewBox="0 0 20 21" xmlns="http://www.w3.org/2000/svg">
export const CompareIcon: SvgFC<{ isFull: boolean }> = ({ isFull, ...props }) => (
<svg {...props} fill={isFull ? 'currentColor' : 'none'} viewBox="0 0 18 17" xmlns="http://www.w3.org/2000/svg">
<path
d="m10.117 14.488.083-.053-.083.053Zm.083.132 3.552 5.63h-7.16l3.608-5.63Z"
fill="transparent"
stroke="currentColor"
strokeLinejoin="round"
strokeWidth="2.5"
/>
<path
d="M4.7 9.624c0 1.134-.897 2.028-1.975 2.028-1.077 0-1.975-.894-1.975-2.028 0-1.133.898-2.027 1.975-2.027 1.078 0 1.976.894 1.976 2.027Z"
fill="transparent"
stroke="currentColor"
strokeWidth="2.5"
/>
<path d="M10.233 1v14.056" stroke="currentColor" strokeLinecap="round" strokeWidth="1.5" />
<path
d="M2.792 6.878V3.646h14.855v2.883"
fill="transparent"
d="M0.75 12.55V12.4261C0.75 12.165 0.75 12.0344 0.769971 11.9072C0.787703 11.7943 0.817123 11.6835 0.857757 11.5767C0.903521 11.4563 0.968295 11.343 1.09784 11.1163L4.05 5.95M0.75 12.55C0.75 14.3725 2.22746 15.85 4.05 15.85C5.87254 15.85 7.35 14.3725 7.35 12.55M0.75 12.55V12.385C0.75 12.154 0.75 12.0385 0.79496 11.9502C0.834508 11.8726 0.897612 11.8095 0.975229 11.77C1.06347 11.725 1.17898 11.725 1.41 11.725H6.69C6.92102 11.725 7.03653 11.725 7.12477 11.77C7.20239 11.8095 7.26549 11.8726 7.30504 11.9502C7.35 12.0385 7.35 12.154 7.35 12.385V12.55M4.05 5.95L7.00216 11.1163C7.1317 11.343 7.19648 11.4563 7.24224 11.5767C7.28288 11.6835 7.3123 11.7943 7.33003 11.9072C7.35 12.0344 7.35 12.165 7.35 12.4261V12.55M4.05 5.95L13.95 4.3M10.65 10.9V10.7761C10.65 10.515 10.65 10.3844 10.67 10.2572C10.6877 10.1443 10.7171 10.0335 10.7578 9.92668C10.8035 9.80634 10.8683 9.69298 10.9978 9.46628L13.95 4.3M10.65 10.9C10.65 12.7225 12.1275 14.2 13.95 14.2C15.7725 14.2 17.25 12.7225 17.25 10.9M10.65 10.9V10.735C10.65 10.504 10.65 10.3885 10.695 10.3002C10.7345 10.2226 10.7976 10.1595 10.8752 10.12C10.9635 10.075 11.079 10.075 11.31 10.075H16.59C16.821 10.075 16.9365 10.075 17.0248 10.12C17.1024 10.1595 17.1655 10.2226 17.205 10.3002C17.25 10.3885 17.25 10.504 17.25 10.735V10.9M13.95 4.3L16.9022 9.46628C17.0317 9.69298 17.0965 9.80634 17.1422 9.92668C17.1829 10.0335 17.2123 10.1443 17.23 10.2572C17.25 10.3844 17.25 10.515 17.25 10.7761V10.9M9 1V5.125"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2.5"
/>
<path
d="M19.25 8.671c0 .95-.751 1.695-1.648 1.695-.897 0-1.648-.745-1.648-1.694 0-.95.751-1.695 1.648-1.695.897 0 1.648.745 1.648 1.694Z"
fill="transparent"
stroke="currentColor"
strokeWidth="2.5"
strokeWidth="1.7"
/>
</svg>
);
14 changes: 9 additions & 5 deletions storefront/components/Basic/Icon/HeartIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
export const HeartIcon: SvgFC<{ isFull: boolean }> = ({ isFull, ...props }) => (
<svg {...props} viewBox="0 0 23 19" xmlns="http://www.w3.org/2000/svg">
<svg
{...props}
fill={isFull ? 'currentColor' : 'none'}
viewBox="0 0 17 15"
width="17"
xmlns="http://www.w3.org/2000/svg"
>
<path
clipRule="evenodd"
d="M20.046 2.591a5.43 5.43 0 0 0-7.681 0l-1.047 1.047-1.046-1.047a5.431 5.431 0 0 0-7.681 7.681l1.046 1.047 6.267 6.267a2 2 0 0 0 2.829 0L19 11.319l1.046-1.047a5.43 5.43 0 0 0 0-7.68Z"
fill={isFull ? 'currentColor' : 'transparent'}
d="M7.73766 2.45036C7.92761 2.6701 8.20372 2.79639 8.49418 2.79639C8.78464 2.79639 9.06075 2.6701 9.2507 2.45036C10.6472 0.834856 12.8338 0.485994 14.5217 1.87418C16.2586 3.30266 16.4712 5.71231 15.1273 7.42342C14.4873 8.23832 13.1449 9.56362 11.7386 10.877C10.4847 12.0481 9.23022 13.1639 8.49418 13.8114C7.75813 13.1639 6.50362 12.0481 5.24973 10.877C3.84348 9.56362 2.50101 8.23832 1.86102 7.42342C0.526134 5.72372 0.752877 3.32325 2.47712 1.86548C4.11809 0.478109 6.33367 0.826203 7.73766 2.45036Z"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2.5"
strokeWidth="2"
/>
</svg>
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CompareIcon } from 'components/Basic/Icon/CompareIcon';
import useTranslation from 'next-translate/useTranslation';
import { twJoin } from 'tailwind-merge';
import { twMergeCustom } from 'utils/twMerge';

type ProductCompareButtonProps = {
Expand All @@ -22,7 +23,10 @@ export const ProductCompareButton: FC<ProductCompareButtonProps> = ({
title={isProductInComparison ? t('Remove product from comparison') : t('Add product to comparison')}
onClick={toggleProductInComparison}
>
<CompareIcon className={isProductInComparison ? 'text-linkHovered' : ''} />
<CompareIcon
className={twJoin('w-5', isProductInComparison ? 'text-link' : '')}
isFull={isProductInComparison}
/>
{isWithText && (
<span className="text-sm">{isProductInComparison ? t('Remove from comparison') : t('Compare')}</span>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HeartIcon } from 'components/Basic/Icon/HeartIcon';
import useTranslation from 'next-translate/useTranslation';
import { HTMLAttributes } from 'react';
import { twJoin } from 'tailwind-merge';
import { ExtractNativePropsFromDefault } from 'types/ExtractNativePropsFromDefault';
import { twMergeCustom } from 'utils/twMerge';

Expand All @@ -26,7 +27,10 @@ export const ProductWishlistButton: FC<ProductCompareButtonProps & NativeProps>
title={isProductInWishlist ? t('Remove product from wishlist') : t('Add product to wishlist')}
onClick={toggleProductInWishlist}
>
<HeartIcon className={isProductInWishlist ? 'text-linkHovered' : ''} isFull={isProductInWishlist} />
<HeartIcon
className={twJoin('w-5', isProductInWishlist ? 'text-heartIconFull' : '')}
isFull={isProductInWishlist}
/>
{isWithText && (
<span className="text-sm">
{isProductInWishlist ? t('Remove from wishlist') : t('Add to wishlist')}
Expand Down
8 changes: 6 additions & 2 deletions storefront/components/Layout/Header/MenuIconic/MenuIconic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { HeartIcon } from 'components/Basic/Icon/HeartIcon';
import { MarkerIcon } from 'components/Basic/Icon/MarkerIcon';
import { useDomainConfig } from 'components/providers/DomainConfigProvider';
import useTranslation from 'next-translate/useTranslation';
import { twJoin } from 'tailwind-merge';
import { useIsUserLoggedIn } from 'utils/auth/useIsUserLoggedIn';
import { useComparison } from 'utils/productLists/comparison/useComparison';
import { useWishlist } from 'utils/productLists/wishlist/useWishlist';
Expand Down Expand Up @@ -41,14 +42,17 @@ export const MenuIconic: FC = () => {

<MenuIconicItem className="max-lg:hidden">
<MenuIconicItemLink href={productComparisonUrl} title={t('Comparison')} type="comparison">
<CompareIcon className="w-4" />
<CompareIcon className="w-4" isFull={!!comparison?.products.length} />
{!!comparison?.products.length && <span>{comparison.products.length}</span>}
</MenuIconicItemLink>
</MenuIconicItem>

<MenuIconicItem>
<MenuIconicItemLink href={wishlistUrl} title={t('Wishlist')} type="wishlist">
<HeartIcon className="w-6 lg:w-4" isFull={!!wishlist?.products.length} />
<HeartIcon
className={twJoin('w-6 lg:w-4', wishlist?.products.length ? 'text-heartIconFull' : '')}
isFull={!!wishlist?.products.length}
/>
<span className="max-lg:hidden">
{!!wishlist?.products.length && <span>{wishlist.products.length}</span>}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const MenuIconicPlaceholder: FC = () => {
</li>

<li className={twJoin('max-lg:hidden', placeholderItemTwClass)}>
<CompareIcon className="w-4" />
<CompareIcon className="w-4" isFull={false} />
</li>

<li className={twJoin('max-lg:hidden', placeholderItemTwClass)}>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions storefront/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ module.exports = {
actionInvertedBorderHovered: '#004EB6',
actionInvertedTextHovered: '#004EB6',

heartIconFull: '#EC5353',

availabilityInStock: '#00CDBE',
availabilityOutOfStock: '#EC5353',

Expand Down

0 comments on commit dd2034b

Please sign in to comment.