Skip to content

clawnic/WebSheet

Repository files navigation

React Spreadsheet Application

A pixel-perfect Google Sheets/Excel-like spreadsheet application built with React 18, TypeScript, and Tailwind CSS.

🚀 Features

  • Pixel-perfect UI: Matches modern spreadsheet applications
  • Interactive Grid: 100 rows × 26 columns with cell selection and editing
  • Formula Support: Basic formula evaluation (e.g., =A1+B1)
  • Toolbar Actions: Font formatting, alignment, colors, and more
  • Sheet Management: Multiple sheet tabs with switching capability
  • Formula Bar: Edit cell values and formulas
  • Keyboard Navigation: Arrow keys for cell navigation
  • Responsive Design: Works on different screen sizes

🛠️ Tech Stack

  • React 18 with TypeScript (strict mode)
  • Tailwind CSS for utility-first styling
  • Vite for fast development and building
  • Lucide React for consistent icons
  • Custom table component for optimal performance

📦 Installation

```bash

Clone the repository

git clone cd spreadsheet-app

Install dependencies

npm install

Start development server

npm run dev

Build for production

npm run build

Preview production build

npm run preview

Run linting

npm run lint

Run type checking

npm run type-check ```

🏗️ Project Structure

``` src/ ├── components/ │ ├── header.tsx # Top navigation and tabs │ ├── toolbar.tsx # Formatting toolbar │ ├── formula-bar.tsx # Formula input bar │ ├── spreadsheet-grid.tsx # Main grid component │ └── sheet-tabs.tsx # Bottom sheet tabs ├── types/ │ └── spreadsheet.ts # TypeScript interfaces ├── utils/ │ └── spreadsheet.ts # Utility functions └── app.tsx # Main application component ```

🎯 Key Features Implemented

Interactive Spreadsheet Grid

  • Cell selection with visual feedback
  • Double-click to edit cells
  • Formula support with basic evaluation
  • Column headers (A, B, C...) and row numbers
  • Sticky headers for better navigation

Comprehensive Toolbar

  • Font family and size selection
  • Text formatting (bold, italic, underline)
  • Text alignment options
  • Color and border tools
  • Number formatting (currency, percentage)

Formula Bar

  • Display and edit cell values/formulas
  • Keyboard shortcuts (Enter to confirm, Escape to cancel)
  • Real-time value updates

Sheet Management

  • Multiple sheet tabs
  • Active sheet highlighting
  • Add new sheet functionality

🔧 Trade-offs and Decisions

Performance Optimizations

  • Virtual scrolling not implemented: For simplicity, rendering all cells upfront
  • Memoization: Used React.useCallback for event handlers to prevent unnecessary re-renders
  • Custom table component: Built from scratch for better control over styling and behavior

Formula Engine

  • Basic implementation: Simple regex-based cell reference replacement
  • Security consideration: Using Function() for evaluation (would use proper parser in production)
  • Limited functions: Only basic arithmetic operations supported

State Management

  • Local component state: No external state management library as per requirements
  • Flat cell storage: Using Record<string, Cell> for O(1) cell access
  • Minimal re-renders: Careful state structure to avoid unnecessary updates

Styling Approach

  • Tailwind CSS: Utility-first approach for rapid development
  • Component-based: Each major section is a separate component
  • Responsive design: Mobile-friendly layout considerations

🎮 Interactive Features

All buttons and interactive elements log actions to the console:

  • Tab switching in header
  • Toolbar button clicks
  • Cell selection and editing
  • Sheet tab switching
  • Formula bar interactions

🚀 Future Enhancements

  • Keyboard navigation with arrow keys
  • Column resizing and hiding
  • Copy/paste functionality
  • Undo/redo operations
  • Advanced formula functions
  • Data validation
  • Chart creation
  • Import/export functionality

📝 Development Notes

  • Code passes `npm run lint` and `npm run type-check`
  • TypeScript strict mode enabled
  • Clean commit history with meaningful messages
  • Pixel-perfect implementation based on modern spreadsheet UX patterns

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Ensure tests pass and code is linted
  5. Submit a pull request

Built with ❤️ for the React Intern Assignment `

This application demonstrates proficiency in React, TypeScript, and modern web development practices while delivering a production-ready spreadsheet interface.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published