Skip to content

Commit 1f37e72

Browse files
author
Sithara Balasuriya
committed
Updated collaboration demo.
1 parent 241e6ae commit 1f37e72

2 files changed

Lines changed: 47 additions & 37 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import type { User } from "@/components/bloks/collaboration";
2+
3+
export const collaborationDemoCurrentUser: User = {
4+
id: "current",
5+
name: "Arshad Hannan",
6+
avatarUrl: "/ArshadHannan.svg",
7+
email: "arshad.hannan@sitecore.com",
8+
};
9+
10+
export const collaborationDemoAvailableUsers: User[] = [
11+
{
12+
id: "2",
13+
name: "Lasith Gunaratne",
14+
avatarUrl: "/LasithGunaratne.png",
15+
email: "lasith.gunaratne@sitecore.com",
16+
},
17+
{
18+
id: "3",
19+
name: "Spyridon Misichronis",
20+
avatarUrl: "/SpyridonMisichronis.png",
21+
email: "spyros.misichronis@sitecore.com",
22+
},
23+
{
24+
id: "4",
25+
name: "Christian Hahn",
26+
avatarUrl: "/ChristianHahn.png",
27+
email: "christian.hahn@sitecore.com",
28+
},
29+
];
30+
31+
/** Initial users shown in the collaboration demo (overflow avatars). */
32+
export const collaborationDemoInitialUsers: User[] = [
33+
collaborationDemoCurrentUser,
34+
collaborationDemoAvailableUsers[0],
35+
collaborationDemoAvailableUsers[1],
36+
collaborationDemoAvailableUsers[2],
37+
];

components-demo/collaboration-demo.tsx

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,18 @@
11
"use client";
22

3+
import {
4+
collaborationDemoAvailableUsers,
5+
collaborationDemoCurrentUser,
6+
collaborationDemoInitialUsers,
7+
} from "@/app/content/bloks/collaboration/collaboration.mock-data";
38
import { Collaboration, type User } from "@/components/bloks/collaboration";
49
import { useCallback, useState } from "react";
510

6-
const currentUser: User = {
7-
id: "current",
8-
name: "Arshad Hannan",
9-
avatarUrl: "/ArshadHannan.svg",
10-
email: "arshad.hannan@sitecore.com",
11-
};
12-
13-
const availableUsers: User[] = [
14-
{
15-
id: "2",
16-
name: "Lasith Gunaratne",
17-
avatarUrl: "/LasithGunaratne.png",
18-
email: "lasith.gunaratne@sitecore.com",
19-
},
20-
{
21-
id: "3",
22-
name: "Spyridon Misichronis",
23-
avatarUrl: "/SpyridonMisichronis.png",
24-
email: "spyros.misichronis@sitecore.com",
25-
},
26-
{
27-
id: "4",
28-
name: "Christian Hahn",
29-
avatarUrl: "/ChristianHahn.png",
30-
email: "christian.hahn@sitecore.com",
31-
},
32-
];
33-
3411
export function CollaborationDemo() {
3512

36-
// Start with multiple users to show overflow behavior (maxDisplayAvatars=3)
37-
const [addedUsers, setAddedUsers] = useState<User[]>([
38-
currentUser,
39-
availableUsers[0],
40-
availableUsers[1],
41-
availableUsers[2],
42-
]);
13+
const [addedUsers, setAddedUsers] = useState<User[]>(
14+
collaborationDemoInitialUsers,
15+
);
4316

4417
const handleAddUser = useCallback((user: User) => {
4518
setAddedUsers((prev) => [...prev, user]);
@@ -58,8 +31,8 @@ export function CollaborationDemo() {
5831
<div className="flex items-start justify-center pt-5 pb-8 px-8 min-h-[400px]">
5932
<Collaboration
6033
users={addedUsers}
61-
currentUser={currentUser}
62-
availableUsers={availableUsers}
34+
currentUser={collaborationDemoCurrentUser}
35+
availableUsers={collaborationDemoAvailableUsers}
6336
onAddUser={handleAddUser}
6437
onRemoveUser={handleRemoveUser}
6538
allowRemoveCurrentUser={false}

0 commit comments

Comments
 (0)