Skip to content

Latest commit

 

History

History
120 lines (83 loc) · 5.34 KB

File metadata and controls

120 lines (83 loc) · 5.34 KB

Frontend Guideline Document

This document outlines the frontend architecture, design principles, and technologies powering our Outline Generation and Summary Composition tool. It’s written in everyday language so everyone—technical or non-technical—can understand how the frontend is set up and why.

1. Frontend Architecture

Overview

We use a component-based setup built on React with TypeScript. Our build tool is Vite, chosen for fast startup and hot-module reloading.

Key Libraries and Frameworks

  • React: For building reusable UI components.
  • TypeScript: Adds type safety and better code clarity.
  • Vite: Modern build tool for quick development feedback.
  • React Router: Manages navigation between different pages.

Scalability, Maintainability, Performance

  • Modular Components: Each feature lives in its own folder, keeping code organized as the app grows.
  • Lazy Loading: We split code so that each section loads only when needed, speeding up initial page loads.
  • Clear Type Definitions: TypeScript interfaces describe data shapes, reducing bugs and making future changes easier.

2. Design Principles

We follow three main principles:

Usability

  • Simple Flows: Every screen guides users step by step—no surprises.
  • Clear Labels: Buttons and headings use everyday words (e.g., “Generate Outline,” “Download PDF”).

Accessibility

  • Keyboard Navigation: All interactive elements can be reached by tabbing.
  • ARIA Labels: Screen-reader friendly attributes on custom controls.
  • Color Contrast: Meets WCAG AA standards for text readability.

Responsiveness

  • Mobile-First: We design for phones first, then scale up to tablets and desktops.
  • Flexible Layouts: CSS Grid and Flexbox adapt to different screen sizes.

3. Styling and Theming

Styling Approach

  • Tailwind CSS: Utility-first framework for quick and consistent styling.
  • BEM Naming: When writing custom CSS modules, we follow Block-Element-Modifier conventions.

Theming

We keep a central theme file (theme.ts) defining colors, spacing, and typography. This ensures consistent branding.

Visual Style

  • Style: Modern flat design with subtle glassmorphism touches on modal backgrounds.
  • Color Palette:
    • Primary: #4F46E5 (indigo)
    • Secondary: #10B981 (emerald)
    • Accent: #F59E0B (amber)
    • Background: #F3F4F6 (light gray)
    • Text: #111827 (dark gray)

Typography

We use the Inter font (free from Google Fonts) for its clean, modern look. Headings are slightly heavier to create visual hierarchy.

4. Component Structure

We organize components by feature (also known as “feature folders”):

  • src/components: Shared UI elements like Button, Modal, Input.
  • src/features/outline: Components and hooks specific to outline generation (e.g., OutlineForm, OutlinePreview).
  • src/features/summary: Components for summary composition.

Reusability

  • Atomic Design: Atoms (Button, Input), Molecules (FormGroup), Organisms (OutlineForm).
  • Single Responsibility: Each component handles one piece of the UI, making maintenance straightforward.

5. State Management

We use React’s Context API with useReducer for global state:

  • Context: Stores user input, generated outline, and export options.
  • Reducer: Defines actions like SET_INPUT, GENERATE_OUTLINE, RESET_DATA.
  • Local State: Minor UI states (like modal open/closed) live in individual components via useState.

This approach avoids over-complexity while keeping data flow clear.

6. Routing and Navigation

We use React Router v6:

  • /: Home page with tool description.
  • /outline: Outline generation interface.
  • /summary: Summary composition interface.
  • /settings: Theme and export preferences.

Navigation is handled by a top-level <Navbar> component. Links update the URL without a full page reload.

7. Performance Optimization

Strategies

  • Code Splitting: Each route’s code is loaded only when the user visits it.
  • Lazy Loading Images: Thumbnails and illustrations load as they scroll into view.
  • Tree Shaking: We rely on Vite’s optimized bundling to remove unused code.
  • Minified Assets: CSS and JS files are minified in production.

These measures ensure fast load times and a snappy experience.

8. Testing and Quality Assurance

Unit Tests

  • Jest + React Testing Library for testing components in isolation.
  • We aim for at least 80% coverage on core logic.

Integration Tests

  • Combine multiple components to test flows (e.g., entering input and seeing an outline preview).

End-to-End Tests

  • Cypress: Simulates user interactions—filling forms, clicking buttons, downloading files.

Linting and Formatting

  • ESLint + Prettier enforce code style.
  • Husky + lint-staged run checks before every commit.

9. Conclusion and Overall Frontend Summary

Our frontend is a modern, scalable React app that balances simplicity with performance. By following clear design principles, a component-based structure, and thorough testing strategies, we ensure a reliable and user-friendly experience. The consistent theming and responsive layouts keep the interface approachable on any device. This setup makes it easy to add new features—like alternative export formats or collaboration tools—without disrupting the core user experience.