Skip to content

Commit

Permalink
Merge pull request #238 from Actualiza-Tu-Carro/116-modificacionmarcas
Browse files Browse the repository at this point in the history
corregida transition carousel
  • Loading branch information
Orliluq authored Nov 28, 2023
2 parents 7804c22 + 2acdbdc commit 5da59ca
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 195 deletions.
221 changes: 46 additions & 175 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 29 additions & 7 deletions src/components/containerCards/containerCardsBrands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@ import { Carousel } from '../carousels/carousel';
import BrandCard from '../cards/brandCard';
import Link from 'next/link';
import { useBrandStore } from '../../store/productStore';
import React from 'react';
import React, { useState, useRef } from 'react';
import Image from 'next/image';
import Ticker from 'framer-motion-ticker';

interface TickerProps {
ref?: React.MutableRefObject<null>;
children: Element[];
duration: number;
items: { name: string; image: string; }[];
auto: boolean;
}

type AnimatedValue = {
animate(): void;
};

const ContainerCardsBrands: React.FC = () => {
const setSelectedBrand = useBrandStore((state) => state.setSelectedBrand);
Expand Down Expand Up @@ -111,29 +124,38 @@ const ContainerCardsBrands: React.FC = () => {
setSelectedBrand(brandName);
};

const value: AnimatedValue = {
animate() {
// Implement the animate method
},
};
value.animate(); // This will work because value is an AnimatedValue

return (
<div className="flex flex-col items-center justify-between mb-24 w-full flex-nowrap overflow-hidden">
<div className="w-full max-w-f-hd py-9">
<Carousel items={undefined} auto={true}>
<div className="flex flex-col items-center justify-between mb-24 w-full flex-nowrap overflow-hidden max-w-[1920px] mx-auto">
<div className="flex items-center justify-center w-full max-w-f-hd py-2 gap-1 relative">

<Ticker duration={70}>
{imagesBrands.map((brand, index) => (
<div
key={index}
onClick={() => handleClick(brand.name)}
className="slider-infinite-scroll autoplay brand-link relative block w-32 h-32 sm:w-40 sm:h-40 m-0 flex items-center"
className="brand-link relative w-32 h-32 sm:w-40 sm:h-40 m-2 flex items-center"
aria-hidden="true"
>
<Link href={`/products?brand=${brand.name}`} key={index}>
<Image
src={brand.image}
alt={brand.name}
className="brand-image object-contain w-full h-full m-0 max-h-[100px] max-w-[100px] hover:scale-110 hover:stop-autoplay"
className="brand-image object-contain w-full h-full m-2 max-h-[100px] max-w-[100px] hover:scale-110 ${!isHovering && 'hover:stop-autoplay'}`;"
width={300}
height={300}
/>
</Link>
</div>
))}
</Carousel>
</Ticker>

</div>
</div>
);
Expand Down
13 changes: 0 additions & 13 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,6 @@ module.exports = {
gap: {
50: '50px',
},
animation: {
'slider-infinite-scroll': 'infinite-scroll 2s ease-in infinite',
},
keyframes: {
'infinite-scroll': {
'0%': {
transform: 'translateX(0)',
},
'100%': {
transform: 'translateX(-50%)',
},
},
},
plugins: [],
},
},
Expand Down

0 comments on commit 5da59ca

Please sign in to comment.