Skip to content

Commit f7ce0a8

Browse files
committed
Restore logos.v2
1 parent ab0b1ab commit f7ce0a8

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import React from "react";
2+
import Marquee from "@/component-library/marquee";
3+
import { cn } from "@/app/components/utils";
4+
import { twMerge } from "tailwind-merge";
5+
6+
export type Logo = {
7+
src: string;
8+
alt: string;
9+
height?: string;
10+
};
11+
12+
export type LogosProps = {
13+
logos?: Logo[];
14+
className?: string;
15+
itemClassName?: string;
16+
fadeColor?: string;
17+
animation?: boolean;
18+
};
19+
20+
export const Logos: React.FC<LogosProps> = ({
21+
logos = [],
22+
className,
23+
itemClassName,
24+
fadeColor = "#000",
25+
animation = true,
26+
}) => {
27+
const items = logos.map((logo, i) => (
28+
<div
29+
key={`${logo.alt}-${i}`}
30+
className={cn(
31+
"flex items-center justify-center relative mr-twd-8 md:mr-twd-12 xl:mr-twd-32 self-center h-[40px]",
32+
itemClassName,
33+
)}
34+
style={{
35+
height: logo.height ?? "",
36+
}}
37+
>
38+
<img
39+
className="block h-full max-h-full max-w-none !w-auto"
40+
src={logo.src}
41+
alt={logo.alt}
42+
loading="lazy"
43+
/>
44+
</div>
45+
));
46+
47+
if (!animation) {
48+
return (
49+
<div
50+
className={twMerge(
51+
"relative w-full flex whitespace-nowrap items-center justify-center scrollbar-hidden overflow-auto",
52+
className,
53+
)}
54+
>
55+
{items}
56+
</div>
57+
);
58+
}
59+
60+
return (
61+
<div
62+
className={cn("relative w-full", className)}
63+
style={
64+
{
65+
"--fade-color": fadeColor,
66+
} as React.CSSProperties
67+
}
68+
>
69+
{/* Left Blur */}
70+
<div className="pointer-events-none absolute left-0 top-0 h-full w-24 bg-gradient-to-r from-[var(--fade-color)] to-transparent z-10" />
71+
{/* Right Blur */}
72+
<div className="pointer-events-none absolute right-0 top-0 h-full w-24 bg-gradient-to-l from-[var(--fade-color)] to-transparent z-10" />
73+
{/* Content */}
74+
<Marquee className="w-full">{items}</Marquee>
75+
</div>
76+
);
77+
};

0 commit comments

Comments
 (0)