Skip to content

Commit

Permalink
feat: cooperatorAvatarList
Browse files Browse the repository at this point in the history
  • Loading branch information
coderz-w committed Oct 8, 2024
1 parent 32249af commit e8105fa
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
37 changes: 37 additions & 0 deletions src/components/cooperation/collaboratorAvatarList/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use client';

import React from 'react';

import { cn } from '@/utils';

interface AvatarCirclesProps {
className?: string;
avatarCount?: number;
avatarUrls: string[];
}

export const CollaboratorAvatarList = ({
avatarCount,
className,
avatarUrls,
}: AvatarCirclesProps) => {
return (
<div className={cn('z-10 flex -space-x-3', className)}>
{avatarUrls.map((url, index) => (
<img
key={index}
className="h-8 w-8 rounded-full border-2 border-white dark:border-gray-800"
src={url}
width={40}
height={40}
alt={`Avatar ${index + 1}`}
/>
))}
{avatarCount && (
<span className="flex h-8 w-8 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">
+{avatarCount}
</span>
)}
</div>
);
};
1 change: 1 addition & 0 deletions src/components/cooperation/cooperationEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const CooperationEditor: React.FC<CooperationEditorProps> = ({ roomId })
fontSize: 14,
wordWrap: 'on',
automaticLayout: true,
scrollBeyondLastLine: false,
}}
loading={<LoadingComponent />}
onChange={handleEditorChange}
Expand Down
14 changes: 13 additions & 1 deletion src/components/cooperation/header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Link from 'next/link';
import React from 'react';

import { CollaboratorAvatarList } from '@/components/cooperation/collaboratorAvatarList';

interface ProjectInfo {
[key: string]: any;
}
Expand All @@ -9,9 +11,16 @@ interface HeaderProps {
roomId: string;
}

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',
];

export const CooperationHeader: React.FC<HeaderProps> = ({ roomId }) => {
return (
<header className=" relative flex flex-row items-center w-[100vw] justify-between bg-transparent py-4 z-[999]">
<header className=" relative flex flex-row items-center w-[100vw] justify-between bg-transparent py-6 z-[999]">
<Link className=" text-white font-bold ml-3" href="/">
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -26,6 +35,9 @@ export const CooperationHeader: React.FC<HeaderProps> = ({ roomId }) => {
<div className=" flex text-white items-center justify-center w-full absolute leading-[5vh] font-[500] text-[16px] pointer-events-none">
{roomId}
</div>
<div className=" pr-20">
<CollaboratorAvatarList avatarUrls={avatarUrls} />
</div>
</header>
);
};
1 change: 1 addition & 0 deletions src/components/cooperation/taskDescription/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const TaskDescription: React.FC<TaskDescriptionProps> = ({}) => {
wordWrap: 'on',
automaticLayout: true,
readOnly: true,
scrollBeyondLastLine: false,
scrollbar: {
horizontal: 'hidden',
horizontalHasArrows: false,
Expand Down

0 comments on commit e8105fa

Please sign in to comment.