Skip to content

feat: implement FileList component (#66) #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2025
Merged

Conversation

nullcoder
Copy link
Owner

Summary

  • Create FileList component for vertical file display similar to GitHub Gist
  • Add Badge component for language indicators
  • Implement copy and download functionality for individual files
  • Add anchor navigation for deep linking to specific files

Implementation Details

Components Created

  • FileList: Main component displaying files vertically with syntax highlighting
  • FileListSkeleton: Loading state component
  • Badge: Reusable badge component for language tags

Features

  • ✅ Vertical file layout (no tabs, GitHub Gist style)
  • ✅ File header with name, language badge, size, and line count
  • ✅ Syntax highlighting using CodeEditor in read-only mode
  • ✅ Copy button for each file's content
  • ✅ Download button for individual files
  • ✅ File size in human-readable format (B, KB, MB, etc.)
  • ✅ Line count display
  • ✅ Anchor navigation (#file-name-index)
  • ✅ Mobile responsive design
  • ✅ Empty state handling
  • ✅ Keyboard accessible with ARIA labels

Utility Functions Added

  • formatFileSize(): Convert bytes to human-readable format
  • countLines(): Count lines in text content
  • fileSlug(): Generate URL-safe slugs from filenames

Tests

  • Comprehensive tests for FileList component
  • Tests for all new utility functions
  • Mock implementations for browser APIs (clipboard, download)

Demo

Created interactive demo page at /demo/file-list showcasing:

  • Multiple file collections (Node.js and Python examples)
  • Loading states
  • Copy/download tracking
  • Anchor navigation examples

Closes #66

Test Plan

  • All tests pass
  • TypeScript compilation succeeds
  • Linting passes (only warnings for any types)
  • Build completes successfully
  • Demo page functions correctly
  • Copy functionality works
  • Download functionality works
  • Anchor navigation works
  • Mobile responsive layout verified

🤖 Generated with Claude Code

nullcoder added 2 commits June 7, 2025 09:02
- Create FileList component for vertical file display
- Add Badge component for language indicators
- Add utility functions: formatFileSize, countLines, fileSlug
- Display file metadata (size, line count, language)
- Implement copy and download functionality for each file
- Add anchor navigation for deep linking (#file-name)
- Create comprehensive tests for FileList
- Create interactive demo page with multiple examples
- Add loading skeleton component for better UX
- Ensure mobile-responsive design
- Follow GitHub Gist vertical layout pattern
Copy link

cloudflare-workers-and-pages bot commented Jun 7, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ghostpaste 274b3df Visit preview Jun 07 2025, 04:09 PM

@nullcoder nullcoder merged commit c2dad1e into main Jun 7, 2025
1 check passed
@nullcoder nullcoder deleted the feat/file-list-component branch June 7, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: create file list/tab component
1 participant