# minagishl/preline-react architecture

> Architecture diagram of the GitHub repository minagishl/preline-react, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/minagishl/preline-react
- Repository: https://github.com/minagishl/preline-react

## Overview

##### Project type and purpose
- This is a React component library (“preline-react”) that packages UI components built on Preline UI (Tailwind CSS) for easy consumption in React apps.
- It provides a collection of layout, content, basic, form, overlay, and navigation components, a context provider, hooks, utilities, Storybook documentation, and a build/test/release pipeline.

##### File structure
- src/components: all React component implementations, organized by category (basic, content, forms, layout, overlays).
- src/hooks: reusable hooks (useDropdown, useModal, etc.).
- src/providers: PrelineProvider, which provides context for components.
- src/utils: helper functions (e.g., classNames).
- src/stories: Storybook stories for each component.
- config files: rollup.config.js (build), jest.config.js (tests), tsconfig.json, vite.config.ts (dev server for examples).
- CI/CD: .github/workflows (release, storybook).
- Package metadata: package.json, pnpm-lock.yaml.

##### README for additional insights
- Confirms tech stack: React + TypeScript + Tailwind CSS.
- Illustrates usage via PrelineProvider.
- Describes development commands: pnpm run storybook, build, test, and the GitHub Actions-based release process.

##### Elements
- Clear labels: “Developer,” “GitHub Repo,” “CI/CD,” “Rollup Build,” “Storybook,” “npm Registry,” “Consumer App.”
- Code push → CI jobs
- CI → npm (publish)
- npm → Consumer App (install)
- Consumer App → PrelineProvider → Components
- Rectangles for system components (Repo, CI server, Registry)

##### Detail and essential elements
- Category of components, the Provider and hooks as separate modules.
- Storybook pipeline as a parallel flow to the library build.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Library Lifecycle Lane
    subgraph "Library Lifecycle"
        direction TB
        Dev["Developer"]:::developer
        Repo["GitHub Repository"]:::repo
        Dev -->|push code| Repo

        subgraph "CI/CD Pipeline" 
            direction TB
            LintTest["Lint & Test"]:::process
            StorybookJob["Build & Deploy Storybook"]:::process
            ReleaseJob["Release & Publish"]:::process
        end
        Repo -->|trigger workflows| LintTest
        Repo -->|trigger workflows| StorybookJob
        Repo -->|trigger workflows| ReleaseJob

        ReleaseJob -->|bundle with Rollup| RollupBuild["Rollup Build (CJS/ESM)"]:::process
        RollupBuild -->|publish| NPM["npm Registry"]:::registry
        StorybookJob -->|deploy docs| GHPages["GitHub Pages"]:::service
    end

    %% Library Source Modules
    subgraph "Source Modules"
        direction TB
        Components["Components"]:::module
        Providers["PrelineProvider"]:::module
        Hooks["Hooks"]:::module
        Utils["Utilities"]:::module
        Entry["Entry Point"]:::module
        Styles["Global Styles"]:::module

        Components -->|includes categories| Basic["Basic"]:::module
        Components --> Content["Content"]:::module
        Components --> Forms["Forms"]:::module
        Components --> Layout["Layout"]:::module
        Components --> Overlays["Overlays"]:::module

        Entry -->|exports modules| Components
        Entry --> Providers
        Entry --> Hooks
        Entry --> Utils

    end

    Repo -->|contains| SourceModules["src"]:::module
    Repo -->|contains| Configs["Config & CI"]:::module

    %% Consumption Lane
    subgraph "Consumer Application"
        direction TB
        ConsumerApp["React Consumer App"]:::consumer
        ConsumerApp -->|installs preline-react| NPM
        ConsumerApp -->|configure Tailwind CSS| StylesConfig["Tailwind config"]:::module
        ConsumerApp -->|wraps with| PrelineProvider["PrelineProvider"]:::module
        PrelineProvider -->|provides context to| Components
    end

    %% Click Events for component mapping
    click Components "https://github.com/minagishl/preline-react/tree/main/src/components"
    click Basic "https://github.com/minagishl/preline-react/blob/main/src/components/Button.tsx"
    click Basic "https://github.com/minagishl/preline-react/blob/main/src/components/Alert.tsx"
    click Basic "https://github.com/minagishl/preline-react/blob/main/src/components/AvatarGroup.tsx"
    click Content "https://github.com/minagishl/preline-react/blob/main/src/components/content/Typography.tsx"
    click Content "https://github.com/minagishl/preline-react/blob/main/src/components/content/Divider.tsx"
    click Content "https://github.com/minagishl/preline-react/blob/main/src/components/content/KBD.tsx"
    click Forms "https://github.com/minagishl/preline-react/blob/main/src/components/forms/Input.tsx"
    click Forms "https://github.com/minagishl/preline-react/blob/main/src/components/forms/Checkbox.tsx"
    click Forms "https://github.com/minagishl/preline-react/blob/main/src/components/forms/Select.tsx"
    click Layout "https://github.com/minagishl/preline-react/blob/main/src/components/layout/Container.tsx"
    click Layout "https://github.com/minagishl/preline-react/blob/main/src/components/layout/Grid.tsx"
    click Overlays "https://github.com/minagishl/preline-react/blob/main/src/components/overlays/Modal.tsx"
    click Overlays "https://github.com/minagishl/preline-react/blob/main/src/components/overlays/Tooltip.tsx"
    click Providers "https://github.com/minagishl/preline-react/blob/main/src/providers/PrelineProvider.tsx"
    click Hooks "https://github.com/minagishl/preline-react/tree/main/src/hooks"
    click Hooks "https://github.com/minagishl/preline-react/blob/main/src/hooks/useDropdown.ts"
    click Hooks "https://github.com/minagishl/preline-react/blob/main/src/hooks/useModal.ts"
    click Hooks "https://github.com/minagishl/preline-react/blob/main/src/hooks/usePreline.ts"
    click Utils "https://github.com/minagishl/preline-react/blob/main/src/utils/classNames.ts"
    click SourceModules "https://github.com/minagishl/preline-react/tree/main/src/components/__tests__"
    click StorybookJob "https://github.com/minagishl/preline-react/tree/main/src/stories"
    click StorybookJob "https://github.com/minagishl/preline-react/blob/main/.storybook/main.ts"
    click StorybookJob "https://github.com/minagishl/preline-react/blob/main/.storybook/preview.tsx"
    click Configs "https://github.com/minagishl/preline-react/blob/main/rollup.config.js"
    click Configs "https://github.com/minagishl/preline-react/blob/main/jest.config.js"
    click Configs "https://github.com/minagishl/preline-react/blob/main/vite.config.ts"
    click Configs "https://github.com/minagishl/preline-react/blob/main/.github/workflows/release.yml"
    click Configs "https://github.com/minagishl/preline-react/blob/main/.github/workflows/storybook.yml"
    click Configs "https://github.com/minagishl/preline-react/blob/main/package.json"
    click Entry "https://github.com/minagishl/preline-react/blob/main/src/index.ts"
    click Styles "https://github.com/minagishl/preline-react/blob/main/src/styles/globals.css"

    %% Styles
    classDef developer fill:#D6E5FF,stroke:#0366D6;
    classDef repo fill:#F0F0F0,stroke:#666666;
    classDef process fill:#E6FFEA,stroke:#28A745;
    classDef service fill:#FFF5E6,stroke:#FFA500;
    classDef module fill:#FFFBE6,stroke:#FFD33A;
    classDef registry fill:#FFF0F0,stroke:#D2691E;
    classDef consumer fill:#F5E6FF,stroke:#8A2BE2;
```
