UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
updated: avatarcircles component to support profie urls (#417)
Sanjay Mali568356207545
diff --git a/registry/default/example/avatar-circles-demo.tsx b/registry/default/example/avatar-circles-demo.tsxindex f8a521ad..0e4dfeac 100644--- a/registry/default/example/avatar-circles-demo.tsx+++ b/registry/default/example/avatar-circles-demo.tsx@@ -1,12 +1,32 @@import AvatarCircles from "@/registry/default/magicui/avatar-circles";-const avatarUrls = [- "https://avatars.githubusercontent.com/u/16860528",- "https://avatars.githubusercontent.com/u/20110627",- "https://avatars.githubusercontent.com/u/106103625",- "https://avatars.githubusercontent.com/u/59228569",+const avatars = [+ {+ imageUrl: "https://avatars.githubusercontent.com/u/16860528",+ profileUrl: "https://github.com/dillionverma",+ },+ {+ imageUrl: "https://avatars.githubusercontent.com/u/20110627",+ profileUrl: "https://github.com/tomonarifeehan",+ },+ {+ imageUrl: "https://avatars.githubusercontent.com/u/106103625",+ profileUrl: "https://github.com/BankkRoll",+ },+ {+ imageUrl: "https://avatars.githubusercontent.com/u/59228569",+ profileUrl: "https://github.com/safethecode",+ },+ {+ imageUrl: "https://avatars.githubusercontent.com/u/59442788",+ profileUrl: "https://github.com/sanjay-mali",+ },+ {+ imageUrl: "https://avatars.githubusercontent.com/u/89768406",+ profileUrl: "https://github.com/itsarghyadas",+ },];export default function AvatarCirclesDemo() {- return <AvatarCircles numPeople={99} avatarUrls={avatarUrls} />;+ return <AvatarCircles numPeople={99} avatarUrls={avatars} />;}diff --git a/registry/default/magicui/avatar-circles.tsx b/registry/default/magicui/avatar-circles.tsxindex aa69cef9..267b6838 100644--- a/registry/default/magicui/avatar-circles.tsx+++ b/registry/default/magicui/avatar-circles.tsx@@ -1,13 +1,18 @@+/* eslint-disable @next/next/no-img-element */"use client";import React from "react";import { cn } from "@/lib/utils";+interface Avatar {+ imageUrl: string;+ profileUrl: string;+}interface AvatarCirclesProps {className?: string;numPeople?: number;- avatarUrls: string[];+ avatarUrls: Avatar[];}const AvatarCircles = ({@@ -18,21 +23,30 @@ const AvatarCircles = ({return (<div className={cn("z-10 flex -space-x-4 rtl:space-x-reverse", className)}>{avatarUrls.map((url, index) => (- <img+ <akey={index}- className="h-10 w-10 rounded-full border-2 border-white dark:border-gray-800"- src={url}- width={40}- height={40}- alt={`Avatar ${index + 1}`}- />+ href={url.profileUrl}+ target="_blank"+ rel="noopener noreferrer"+ >+ <img+ key={index}+ className="h-10 w-10 rounded-full border-2 border-white dark:border-gray-800"+ src={url.imageUrl}+ width={40}+ height={40}+ alt={`Avatar ${index + 1}`}+ />+ </a>))}- <a- className="flex h-10 w-10 items-center justify-center rounded-full border-2 border-white bg-black text-center text-xs font-medium text-white hover:bg-gray-600 dark:border-gray-800 dark:bg-white dark:text-black"- href=""- >- +{numPeople}- </a>+ {numPeople && (+ <a+ className="flex h-10 w-10 items-center justify-center rounded-full border-2 border-white bg-black text-center text-xs font-medium text-white hover:bg-gray-600 dark:border-gray-800 dark:bg-white dark:text-black"+ href="#"+ >+ +{numPeople}+ </a>+ )}</div>);};