index.less


Overview

The index.less file defines the styling rules for rendering .docx document views within the PlanGrid application. Its primary role is to provide consistent and visually coherent CSS styles, specifically tailored to display Microsoft Word (.docx) documents in a web environment while maintaining readability, formatting, and layout fidelity.

This stylesheet includes:

The file leverages nested rules and global overrides to isolate document styling within the viewer component while ensuring the document content respects standard HTML semantics.


Detailed Explanation

Top-level Container: .docxViewerWrapper

Global Document Container Override: :global(.document-container)

HTML Element Display and Typography Resets

The file sets display properties and typographic defaults for many HTML elements to ensure the document content renders uniformly and predictably:

Print Media Query


Implementation Details and Algorithms


Interaction With the System


Usage Example

A typical usage would be:

<div className="docxViewerWrapper">
  <div className="box">
    <div className="document-container">
      {/* Parsed .docx content as HTML here */}
    </div>
  </div>
</div>

The index.less provides styles that ensure this content is scrollable, sized correctly, and displays the document content with fidelity.


Visual Diagram

flowchart TD
    A[.docxViewerWrapper]
    A --> B[.box]
    B --> C[:global(.document-container)]
    C --> D[HTML Document Elements]
    D -->|styled| E[Headings (h1-h6)]
    D -->|styled| F[Paragraphs, Blockquotes, Lists]
    D -->|styled| G[Tables (table, tr, td, th)]
    D -->|styled| H[Inline Elements (i, em, cite, code)]
    D -->|styled| I[Form Controls (button, input, select)]
    A --> J[Scrollbar (overflow-y: scroll)]
    C --> K[Bidirectionality Styles (DIR=ltr/rtl)]
    C --> L[Print Media Query]

Summary

The index.less file is a highly specialized style sheet designed to render .docx document content within a web-based viewer. It provides detailed CSS resets and formatting rules to preserve document structure, typography, and layout. It supports bidirectional text, responsive images, and print-friendly formatting. This file integrates tightly with the document viewer UI component, ensuring consistent user experience across document types and languages.