Skip to content

programistka/stickynotes

Repository files navigation

πŸ“ Sticky Notes App

A modern, interactive sticky notes application built with React, TypeScript, and Vite. Create, edit, organize, and delete notes with a beautiful drag-and-drop interface.

React TypeScript Vite Tests


✨ Features

πŸ“Œ Note Management

  • Create notes - Click anywhere on the dashboard to create a new note
  • Edit text - Double-click on a note to edit its content
  • Move notes - Drag and drop notes anywhere on the screen
  • Resize notes - Drag the bottom-right corner to resize (150-400px)
  • Delete notes - Drag notes to the trash area at the bottom to delete

🎨 Customization

  • 5 colors - Choose from yellow, green, blue, pink, or purple
  • 3 sizes - Small (150x150), Medium (200x200), Large (300x300)
  • Persistent storage - Notes are saved to localStorage automatically
  • Z-index management - Click a note to bring it to front

πŸ—‘οΈ Trash System

  • Visual feedback - Notes turn red when hovering over trash
  • Easy deletion - Drag and drop to delete
  • Trash indicator - Pink background shows trash area

πŸ’‘ Help System

  • Interactive guide - Click the "?" button for instructions
  • 7 steps tutorial - Learn all features quickly

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Clone the repository
git clone https://github.com/programistka/stickynotes.git
cd stickynotes

# Install dependencies
npm install

# Start development server
npm run dev

The app will be available at http://localhost:5173


πŸ“– How to Use

Creating a Note

  1. Select a color from the color picker (top-left)
  2. Select a size: Small, Medium, or Large
  3. Click anywhere on the dashboard
  4. A new note appears at the clicked position

Editing a Note

  1. Double-click on any note
  2. Type your text
  3. Click outside or press ESC to save/cancel

Moving a Note

  1. Click and hold on a note
  2. Drag it to the desired position
  3. Release to drop

Resizing a Note

  1. Hover over the bottom-right corner (⇲ icon appears)
  2. Click and drag to resize
  3. Minimum: 150x150px, Maximum: 400x400px

Deleting a Note

  1. Click and drag a note
  2. Move it to the pink "Trash area" at the bottom
  3. Note turns red when over trash
  4. Release to delete

Clearing All Notes

  • Click the "Clear All" button in the top-right corner
  • Button is disabled when there are no notes

πŸ§ͺ Testing

Run Tests

# Run all tests
npm test

# Run tests in watch mode
npm test -- --watch

# Run tests with UI
npm run test:ui

# Generate coverage report
npm run test:coverage

Test Coverage

Test Files  8 passed (8)
     Tests  58 passed (58)
  Coverage  ~56%

- Statements: 56.33% (160/284)
- Branches: 45.74% (43/94)
- Functions: 49.39% (41/83)
- Lines: 58.42% (156/267)

Test Structure

src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ Dashboard/
β”‚   β”‚   β”œβ”€β”€ Dashboard.test.tsx
β”‚   β”‚   └── Note/
β”‚   β”‚       └── Note.test.tsx
β”‚   └── Toolbar/
β”‚       β”œβ”€β”€ Toolbar.test.tsx
β”‚       β”œβ”€β”€ Help/
β”‚       β”‚   └── Help.test.tsx
β”‚       β”œβ”€β”€ NoteColor/
β”‚       β”‚   └── NoteColor.test.tsx
β”‚       └── NoteSize/
β”‚           └── NoteSize.test.tsx
β”œβ”€β”€ hooks/
β”‚   └── useNoteManagement.test.ts
└── reducers/
    └── notesReducer.test.ts

πŸ› οΈ Tech Stack

Core

  • React 19.2 - UI framework
  • TypeScript 5.9 - Type safety
  • Vite 7.2 - Build tool & dev server

State Management

  • React Context API - Global state
  • useReducer - Complex state logic
  • Custom hooks - Business logic encapsulation

Styling

  • CSS Modules - Scoped styling
  • Classnames - Dynamic CSS classes

Testing

  • Vitest - Unit test framework
  • React Testing Library - Component testing
  • @testing-library/user-event - User interaction simulation

Code Quality

  • ESLint - Code linting
  • Prettier - Code formatting
  • Husky - Git hooks
  • Commitlint - Commit message linting

πŸ“ Project Structure

stickynotes/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Dashboard/       # Main workspace
β”‚   β”‚   β”‚   β”œβ”€β”€ Note/        # Individual note component
β”‚   β”‚   β”‚   └── Trash/       # Trash area component
β”‚   β”‚   └── Toolbar/         # Top toolbar
β”‚   β”‚       β”œβ”€β”€ NoteColor/   # Color picker
β”‚   β”‚       β”œβ”€β”€ NoteSize/    # Size selector
β”‚   β”‚       └── Help/        # Help modal
β”‚   β”œβ”€β”€ contexts/
β”‚   β”‚   └── NotesContext.tsx # Global state management
β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”œβ”€β”€ useNoteManagement.ts  # Note interaction logic
β”‚   β”‚   β”œβ”€β”€ useNotesApi.ts        # Mock API
β”‚   β”‚   └── useLocalStorage.ts    # Persistent storage
β”‚   β”œβ”€β”€ reducers/
β”‚   β”‚   └── notesReducer.ts       # State reducer
β”‚   β”œβ”€β”€ test/
β”‚   β”‚   β”œβ”€β”€ setup.ts         # Test configuration
β”‚   β”‚   └── test-utils.tsx   # Test helpers
β”‚   β”œβ”€β”€ types.ts             # TypeScript types
β”‚   β”œβ”€β”€ utils.ts             # Utility functions
β”‚   β”œβ”€β”€ App.tsx              # Root component
β”‚   └── main.tsx             # Entry point
β”œβ”€β”€ vitest.config.ts         # Test configuration
β”œβ”€β”€ vite.config.ts           # Build configuration
β”œβ”€β”€ tsconfig.json            # TypeScript config
β”œβ”€β”€ eslint.config.js         # ESLint config
└── package.json

🎨 UI/UX Features

Visual Feedback

  • βœ… Hover effects on buttons
  • βœ… Note turns red when over trash
  • βœ… Shadow effects for depth
  • βœ… Smooth animations (transitions)
  • βœ… Gradient buttons

Responsive Design

  • βœ… Fixed toolbar (100px height)
  • βœ… Fixed trash area (100px height)
  • βœ… Flexible dashboard area
  • βœ… Works on all screen sizes

πŸ”§ Development

Available Scripts

# Development
npm run dev          # Start dev server

# Building
npm run build        # Build for production
npm run preview      # Preview production build

# Code Quality
npm run lint         # Run ESLint

# Testing
npm test             # Run tests
npm run test:ui      # Open test UI
npm run test:coverage # Generate coverage report

Environment Setup

  1. Install dependencies:

    npm install
  2. Start development:

    npm run dev
  3. Run tests:

    npm test
  4. Build for production:

    npm run build

About

Modern sticky notes app - React + TypeScript + Vite

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published