const contacts = [ { name: "Karthikeya", phone: "+91 8978219896", }, { name: "Prajwala", phone: "+91 7702019255", }, { name: "Aashritha", phone: "+91 8297828446", }, { name: "Manoj", phone: "+91 9010303229", }, ];
For the above , Give me a good marequee component using tailwind. And i am using new tailwind version
I'll create a marquee component using Tailwind CSS for the contacts you provided. I'll use the latest Tailwind CSS features and best practices to create a smooth, responsive marquee effect.
Here's a React component that creates a marquee effect for your contacts using Tailwind CSS:
This marquee component uses Tailwind CSS to create a smooth scrolling effect for your contacts. Here's a breakdown of the key features:
tailwind.config.ts
file 2.To use this component, you would import it into your page or layout file like this:
import MarqueeContacts from './path/to/MarqueeContacts';
export default function Page() {
return (
<div>
<h1 className="text-2xl font-bold mb-4">Contact Marquee</h1>
<MarqueeContacts />
</div>
);
}
This will create a horizontally scrolling marquee of contact cards. Each card displays the contact's name and phone number, with the first letter of their name in a blue circle for visual appeal.
The marquee effect is achieved by duplicating the contact list and using a CSS animation to create a seamless loop. The animation duration is set to 25 seconds, but you can adjust this in the tailwind.config.ts
file to make it faster or slower.
Remember to include the tailwind.config.ts
file in your project to enable the custom animation. This configuration extends Tailwind's default theme with the custom marquee animation 2.
I'll modify the marquee component to match a dark UI with a black background, using ash or zinc colors from Tailwind's palette. This will create a sleek, modern look that's easy on the eyes in dark environments.
I've updated the MarqueeContacts
component to use a dark color scheme that complements a black background. Here's a breakdown of the changes and features:
Color Scheme:
bg-zinc-900
for the outer container, creating a subtle contrast with the black page background.bg-zinc-800
for the card background, with a hover state of bg-zinc-700
for interactivity.text-zinc-200
for names (lighter) and text-zinc-400
for phone numbers (slightly muted).bg-zinc-600
with text-zinc-200
for the initials, providing a nice contrast 1.tailwind.config.ts
file if you prefer a different speed 2.To use this component in your black-background UI, you can import and use it like this:
import MarqueeContacts from './path/to/MarqueeContacts';
export default function Page() {
return (
<div className="bg-black min-h-screen p-8">
<h1 className="text-2xl font-bold mb-4 text-zinc-100">Contact Marquee</h1>
<MarqueeContacts />
</div>
);
}
This will create a sleek, dark-themed marquee that scrolls your contacts horizontally. The design now uses various shades of zinc to create depth and contrast against a black background, resulting in a modern and visually appealing component that's easy on the eyes in dark environments.
Remember to include the tailwind.config.ts
file in your project to enable the custom animation and ensure all the necessary Tailwind classes are available 2.
const items = [ { name: "Sophia Martinez", title: "Lead designer, Avalon", image: "https://images.generated.photos/TdA_3xKb49DtgqfPPu5REnQFiALErCu6i3M2I_1AqIA/rs:fit:256:256/czM6Ly9pY29uczgu/Z3Bob3Rvcy1wcm9k/LnBob3Rvcy92M18w/MDAwNTU5LmpwZw.jpg", body: "I've been in the design game for a while now and this kit is one of the best. It's made me fall in love with designing all over again. It's just brilliant.", }, { name: "Caroline Lee", title: "Senior Graphic Designer, Echo", image: "https://images.generated.photos/mp3gkB9z2wwhyySWzQJMegNbvvLV6HbKQX1_h6BEYAc/rs:fit:256:256/czM6Ly9pY29uczgu/Z3Bob3Rvcy1wcm9k/LnBob3Rvcy92M18w/MDAwOTI5LmpwZw.jpg", body: "I'm a newbie designer and this kit is just perfect. I've learnt so much and my work looks amazing now. A big thumbs up!", }, { name: "Tyler Otwell", title: "CTO, Apple", image: "https://images.generated.photos/vOkveSlBohR880A8z67aLHImhPr7UHdnXg06pifYvZ4/rs:fit:256:256/czM6Ly9pY29uczgu/Z3Bob3Rvcy1wcm9k/LnBob3Rvcy92M18w/MDAyNjg4LmpwZw.jpg", body: "This design kit is a game changer! My designs look better and I get things done faster. Totally recommending it to my mates!", }, { name: "Jake Harris", title: "Thompson Creative", image: "https://images.generated.photos/d_r3VzW3lO5ZsdaHhoVX7msWku7YIrqP4Qn1yozJU54/rs:fit:256:256/czM6Ly9pY29uczgu/Z3Bob3Rvcy1wcm9k/LnBob3Rvcy92M18w/MDAyMTQ4LmpwZw.jpg", body: "I'm a newbie designer and this kit is just perfect. I've learnt so much and my work looks amazing now. A big thumbs up!", }, ]
export default function Page() { return ( <div className="relative flex h-screen w-screen items-center"> <div className="relative flex max-w-[100vw] overflow-hidden py-5"> <div className="flex w-max animate-marquee [--duration:30s] hover:[animation-play-state:paused]"> {[...items, ...items].map((item, index) => ( <div key={index} className="h-full px-2.5"> <div className="relative h-full w-[28rem] rounded-2xl border border-white/5 bg-white/5 px-8 py-6"> <div className="pb-4 font-light text-white/75">{item.body}</div>
<div className="mt-auto flex items-center gap-4">
<img src={item.image} className="h-9 w-9 rounded-full" />
<div className="flex flex-col text-sm">
<div className="text-white">{item.name}</div>
<div className="text-white/75">{item.title}</div>
</div>
</div>
</div>
</div>
))}
</div>
</div>
</div>
) }
Give in this type of format