diff --git a/astro-app/src/components/ProjectsView.tsx b/astro-app/src/components/ProjectsView.tsx index 1ce9287..233713e 100644 --- a/astro-app/src/components/ProjectsView.tsx +++ b/astro-app/src/components/ProjectsView.tsx @@ -1,11 +1,11 @@ import { useState } from 'react'; -import { Tabs, TabsContent, TabsList, TabsTrigger } from './ui/tabs'; import { ProjectsTable } from './ProjectsTable'; import { ProjectCard } from './ProjectCard'; import { ThemeToggle } from './ThemeToggle'; import { LayoutGrid, Table } from 'lucide-react'; import { Button } from './ui/button'; import type { TwitterProject } from '@/lib/csv-loader'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from './ui/tabs'; interface ProjectsViewProps { projects: TwitterProject[]; @@ -18,6 +18,8 @@ export function ProjectsView({ projects }: ProjectsViewProps) { const projectsWithUrls = projects.filter(p => p.project_url); const projectsWithoutUrls = projects.filter(p => !p.project_url); + console.log(projects); + return (
diff --git a/astro-app/src/components/ui/tabs.tsx b/astro-app/src/components/ui/tabs.tsx index c967d5a..f0a8f92 100644 --- a/astro-app/src/components/ui/tabs.tsx +++ b/astro-app/src/components/ui/tabs.tsx @@ -1,68 +1,115 @@ import * as React from "react" +import { Tabs as BaseTabs } from "@base-ui-components/react/tabs" import { cn } from "@/lib/utils" -const Tabs = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)) -Tabs.displayName = "Tabs" +type TabsVariant = "capsule" | "underline" -const TabsList = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)) -TabsList.displayName = "TabsList" +type TabsContext = { + variant: TabsVariant +} -const TabsTrigger = React.forwardRef< - HTMLButtonElement, - React.ButtonHTMLAttributes & { - value: string - } ->(({ className, value, children, ...props }, ref) => ( - -)) -TabsTrigger.displayName = "TabsTrigger" +const TabsContext = React.createContext(null) -const TabsContent = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes & { - value: string - } ->(({ className, value, ...props }, ref) => ( -
-)) -TabsContent.displayName = "TabsContent" +const useTabs = () => { + const context = React.useContext(TabsContext) -export { Tabs, TabsList, TabsTrigger, TabsContent } \ No newline at end of file + if (!context) { + throw new Error("useTabs must be used within a Tabs") + } + + return context +} + +function Tabs({ + variant = "capsule", + className, + ...props +}: React.ComponentProps & { + variant?: TabsVariant +}) { + return ( + + + + ) +} + +function TabsList({ + className, + children, + ...props +}: React.ComponentProps) { + const { variant } = useTabs() + + return ( + + {children} + + + ) +} + +function TabsTrigger({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function TabIndicator({ + className, + ...props +}: React.ComponentProps) { + const { variant } = useTabs() + + return ( + + ) +} + +function TabsContent({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +export { Tabs, TabsList, TabsTrigger, TabsContent } diff --git a/astro-app/src/pages/projects.astro b/astro-app/src/pages/projects.astro index 136d829..7c325e3 100644 --- a/astro-app/src/pages/projects.astro +++ b/astro-app/src/pages/projects.astro @@ -24,7 +24,7 @@ const projects = await loadTwitterProjects(); - + \ No newline at end of file