'use client';
import * as React from 'react';
import {
Workspaces,
WorkspaceTrigger,
WorkspaceContent,
type Workspace,
} from '@/components/ui/workspaces';
import { Button } from '@/components/ui/button';
import { PlusIcon } from 'lucide-react';
// Extended workspace interface for this specific use case
interface MyWorkspace extends Workspace {
logo: string;
plan: string;
slug: string;
}
const workspaces: MyWorkspace[] = [
{
id: '1',
name: 'Asme Inc.',
logo: 'https://cdn.21st.dev/assets/mirror/bc/bcc1d61f4fed0e8e24b9b4da38783d3dc8b89fbf680bab0b4c492899b389ada9.png',
plan: 'Free',
slug: 'asme',
},
{
id: '2',
name: 'Bilux Labs',
logo: 'https://cdn.21st.dev/assets/mirror/e3/e384379f340a9656b50470215b55a04e83bc4da060a79b2345eeb42cd74d8ce0.png',
plan: 'Pro',
slug: 'bilux',
},
{
id: '3',
name: 'Zentra Ltd.',
logo: 'https://cdn.21st.dev/assets/mirror/bb/bbf794851f7542ebb90db83ffe8bc488ad3eaded2a60a1467e9a0ad7677a66bc.png',
plan: 'Team',
slug: 'zentra',
},
{
id: '4',
name: 'Nuvex Group',
logo: 'https://cdn.21st.dev/assets/mirror/9a/9a8e397bb8799f8bf50c0d5cfe4bc88cc55e1dac0d84a8e97ee37afb88ef360d.png',
plan: 'Free',
slug: 'nuvex',
},
{
id: '5',
name: 'Cortexia',
logo: 'https://cdn.21st.dev/assets/mirror/d2/d214eb22d429424706b048bb9092bf76d6cd9879400696c90bfd458fd737aecd.png',
plan: 'Pro',
slug: 'cortexia',
},
];
export default function Default() {
const [activeWorkspaceId, setActiveWorkspaceId] = React.useState('1');
const handleWorkspaceChange = (workspace: MyWorkspace) => {
setActiveWorkspaceId(workspace.id);
console.log('Selected workspace:', workspace);
};
return (
<div className="flex min-h-screen items-start justify-center gap-8 px-4 py-24">
<Workspaces
workspaces={workspaces}
selectedWorkspaceId={activeWorkspaceId}
onWorkspaceChange={handleWorkspaceChange}
>
<WorkspaceTrigger className="min-w-72" />
<WorkspaceContent>
<Button
variant="ghost"
size="sm"
className="text-muted-foreground w-full justify-start"
>
<PlusIcon className="mr-2 h-4 w-4" />
Create workspace
</Button>
</WorkspaceContent>
</Workspaces>
</div>
);
}