'use client' import Image, { StaticImageData } from 'next/image' import { Card } from '@/components/Card' import { SimpleLayout } from '@/components/SimpleLayout' import logoZed from '@/images/logos/zed.png' import logoDesignDocs from '@/images/logos/designdocs.svg' import logoCode from '@/images/logos/code.svg' import logoDesign from '@/images/logos/design.svg' import logoArt from '@/images/logos/art.svg' import { useMemo, useState } from 'react' import { Button } from '@/components/Button' import clsx from 'clsx' const projectType = { code: 'Code', design: 'Design', art: 'Art', writing: 'Writing', } as const type ProjectType = typeof projectType[keyof typeof projectType] const withFilterType = { details: 'Details', code: 'Code', } as const type WithFilterType = typeof withFilterType[keyof typeof withFilterType] interface Project { name: string lastUpdate: number description: string type: ProjectType[] link?: { href: string label: string } github?: { href: string label: string } details?: { href: string label: string } logo: StaticImageData } const projects: Project[] = [ { name: 'Leetcode', lastUpdate: 2023, description: 'A collection of my Leetcode solutions', link: { href: 'https://github.com/iamnbutler/leetcode', label: 'iamnbutler/leetcode' }, type: ['Code'], logo: logoCode, }, { name: 'Zed', lastUpdate: 2023, description: 'A native text editor turned collaboration platform to help developers build software together.', link: { href: 'https://zed.dev/download', label: 'zed.dev/download' }, type: ['Code', 'Design'], logo: logoZed, }, { name: 'GPT Tools', lastUpdate: 2023, description: 'a collection of prompts + scripts for working with gpt', github: { href: 'https://github.com/iamnbutler/gpt-tools', label: 'iamnbutler/gpt-tools', }, type: ['Code'], logo: logoCode, }, { name: 'Zed.dev', lastUpdate: 2023, description: 'A Next.js site for Zed', link: { href: 'https://zed.dev/', label: 'zed.dev' }, type: ['Code', 'Design'], logo: logoZed, }, { name: 'Design Docs', lastUpdate: 2022, description: 'An open-source, semi-opinionated design industry documentation focused on early career designers. A work in progress!', link: { href: 'https://www.designdocs.co/', label: 'designdocs.co' }, github: { href: 'https://github.com/iamnbutler/design-docs', label: 'iamnbutler/design-docs', }, type: ['Code'], logo: logoDesignDocs, }, { name: 'fig-gen', lastUpdate: 2021, description: 'Exploring Figma Automator actions that create generative visuals', github: { href: 'https://github.com/iamnbutler/fig-gen', label: 'iamnbutler/fig-gen', }, type: ['Art', 'Code'], logo: logoArt, }, { name: 'Zed Fonts', lastUpdate: 2021, description: 'A custom build of the Iosevka font for Zed.', github: { href: 'https://github.com/zed-industries/zed-fonts', label: 'zed-industries/zed-fonts', }, type: ['Design'], logo: logoZed, }, { name: 'FB iOS11 GUI Backgrounds', lastUpdate: 2017, description: 'A set of abstract 3D backgrounds for the Facebook iOS 11 GUI resource.', github: { href: 'https://design.facebook.com/toolsandresources/ios-11-iphone-gui/', label: 'design.fb/ios-11-gui', }, type: ['Art', 'Design'], logo: logoArt, }, { name: 'Explorer', lastUpdate: 2016, description: 'A python pi-powered roverbot', github: { href: 'https://github.com/iamnbutler/explorer', label: 'iamnbutler/explorer', }, type: ['Code'], logo: logoCode, }, { name: 'Tetris', lastUpdate: 2015, description: 'Tetris written in processing, to be played on an LED matrix.', github: { href: 'https://github.com/iamnbutler/tetris', label: 'iamnbutler/tetris', }, type: ['Code'], logo: logoCode, }, { name: 'Music Stats', lastUpdate: 2015, description: 'A music stat charting experiment. Uses D3 and TSVs generated from iTunes playlists.', github: { href: 'https://github.com/iamnbutler/music-stats', label: 'iamnbutler/music-stats', }, type: ['Code', 'Art'], logo: logoCode, }, { name: 'Kaishi', lastUpdate: 2015, description: 'A minimal HTML/CSS project starter', github: { href: 'https://github.com/iamnbutler/kaishi', label: 'iamnbutler/kaishi', }, type: ['Code'], logo: logoCode, }, { name: 'Stagout', lastUpdate: 2013, description: 'A website for the rap/hip-hop duo Sandy Pearlman & Bones', github: { href: 'https://github.com/iamnbutler/stagout', label: 'iamnbutler/stagout', }, type: ['Code', 'Design'], logo: logoCode, }, { name: 'Splash Page', lastUpdate: 2012, description: 'A simple splash page for my upcoming site', github: { href: 'https://github.com/iamnbutler/splash-page', label: 'iamnbutler/splash-page', }, type: ['Code', 'Design'], logo: logoCode, }, ] function LinkIcon(props: React.ComponentPropsWithoutRef<'svg'>) { return ( ) } // export const metadata: Metadata = { // title: 'Projects', // description: 'Things I’ve made.', // } export default function Projects() { const [filter, setFilter] = useState('all'); const [withFilters, setWithFilters] = useState([]); const filteredProjects = useMemo(() => { let result = projects; if (filter !== 'all') { result = result.filter((p) => p.type.includes(filter)); } withFilters.forEach((filter) => { if (filter === 'Code') { result = result.filter((p) => p.type.includes('Code')); } else if (filter === 'Details') { result = result.filter((p) => p.details); } }); return result; }, [filter, withFilters]); return ( Filter setFilter('all')} > All {Object.values(projectType).map((type) => ( p.type.includes(type)).length === 0} className={clsx( projects.filter((p) => p.type.includes(type)).length === 0 && 'opacity-40 cursor-not-allowed', 'rounded-md')} onClick={() => setFilter(type)} > {type} ))} With {/* With Filters */} {Object.values(withFilterType).map((type) => ( setWithFilters(withFilters.includes(type) ? withFilters.filter((f) => f !== type) : [...withFilters, type])} > {type} ))} {filteredProjects.map((project) => ( {project.name} {project.lastUpdate} {project.description} {(project.link?.label || project.github?.label || project.details?.label) ?? ''} ))} {filteredProjects.length === 0 && ( No projects found. )} ) }
Filter
With
{(project.link?.label || project.github?.label || project.details?.label) ?? ''}
No projects found.