summaryrefslogtreecommitdiff
path: root/src/lib/brand/components/BrandCard.jsx
blob: 411e26694d57e29f898d9e71a9b857979e9c534a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import NextImage from 'next/image';
import Link from '@/core/components/elements/Link/Link';
import useDevice from '@/core/hooks/useDevice';
import { createSlug } from '@/core/utils/slug';

const BrandCard = ({ brand }) => {
  const { isMobile } = useDevice();
  // console.log("Brand logo:", brand.logo);
  return (
    <Link
      href={createSlug('/shop/brands/', brand.name, brand.id)}
      className={`py-1 px-2  border-gray_r-6 flex justify-center items-center hover:scale-110 transition duration-500 ease-in-out ${
        isMobile ? 'h-16' : 'h-24'
      }`}
      aria-label={brand.name}
    >
      {brand.logo && (
        <NextImage
          src={brand.logo}
          alt={brand.name}
          width={500}
          height={500}
          quality={85}
          className='h-full w-[122px] object-contain object-center'
          loading='eager'
        />
      )}
      {!brand.logo && (
        <span
          className='text-center'
          style={{ fontSize: `${16 - brand.name.length * 0.5}px` }}
        >
          {brand.name}
        </span>
      )}
    </Link>
  );
};

export default BrandCard;