# vtex-apps/slider-layout architecture

> Architecture diagram of the GitHub repository vtex-apps/slider-layout, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vtex-apps/slider-layout
- Repository: https://github.com/vtex-apps/slider-layout

## Overview

##### Project type and purpose
- Slider Layout is a VTEX IO app that provides a reusable, configurable React UI component (a carousel/slider) for the VTEX Store Framework.
- It does not include a standalone backend service; it ships code (JS, TS, JSON schemas) that is deployed into the VTEX runtime and runs in the browser, integrating with VTEX’s block editor and Google Analytics 4 (GA4).

##### File structure
- Top‐level metadata and configuration:
- manifest.json – declares the app, its blocks (`slider-layout`, `slider-layout-group`), and dependencies.
- store/ (contentSchemas.json, interfaces.json) – defines the schema of block props for the VTEX Site Editor.
- messages/ – JSON files for i18n (block labels, descriptions).
- React implementation under react/:
- hooks/ – custom hooks (useAutoplay, useTouchHandlers, useKeyboardArrows, etc.) encapsulating behavior.
- modules/ – utility functions (cssHandles).
- SliderLayout.tsx and SliderLayoutGroup.tsx – entry points for each block.
- fixtures, mocks, tests – unit tests for components and hooks.
- CI/CD and QA:
- .github/workflows – pull-request checks.
- ESLint, Prettier, TypeScript configs.
- CHANGELOG.md, crowdin.yml for translations.

##### README for additional insights
- Describes two blocks: `slider-layout` (renders a carousel given children) and `slider-layout-group` (syncs multiple sliders).
- Explains GA4 integration via a `view_promotion` event.
- Shows prop types, CSS handles, advanced configuration, and customization guide.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "VTEX Platform"
        style VTEXPlatform fill:#D6EAF8,stroke:#3498DB
        Admin["VTEX Admin"] 
        SiteEditor["Site Editor"]
        StoreFW["Store Framework Runtime"]
    end

    subgraph "Slider Layout App"
        style SliderApp fill:#D5F5E3,stroke:#27AE60
        subgraph "Configuration"
            Manifest["manifest.json"] 
            ContentSchemas["contentSchemas.json"]
            Interfaces["interfaces.json"]
            Messages["i18n messages"]
        end
        subgraph "Implementation"
            Entry1["SliderLayout.tsx"]
            Entry2["SliderLayoutGroup.tsx"]
            subgraph "Components"
                Slider["Slider.tsx"]
                Arrow["Arrow.tsx"]
                Dots["PaginationDots.tsx"]
                Track["SliderTrack.tsx"]
                Context["SliderContext.tsx"]
            end
            subgraph "Hooks"
                Auto["useAutoplay.ts"]
                Touch["useTouchHandlers.ts"]
                KeyNav["useKeyboardArrows.ts"]
                Hover["useHovering.ts"]
                Resize["useScreenResize.ts"]
                Controls["useSliderControls.ts"]
                Visibility["useSliderVisibility.ts"]
            end
            CSSHandles["cssHandles.ts"]
        end
        subgraph "Quality & CI"
            Mocks["__mocks__/"]
            Fixtures["__fixtures__/"]
            Tests["__tests__/"]
            CI["pull-request.yml"]
            Crowdin["crowdin.yml"]
            Changelog["CHANGELOG.md"]
        end
    end

    subgraph "Browser (User)"
        Browser["Browser Runtime"]
    end

    subgraph "External Services"
        GA4["Google Analytics 4 API"]
    end

    Admin --> SiteEditor
    SiteEditor --> ContentSchemas
    SiteEditor --> Interfaces
    SiteEditor --> Messages
    SiteEditor --> StoreFW
    StoreFW --> Manifest
    StoreFW --> Entry1
    StoreFW --> Entry2
    StoreFW --> Browser
    Browser --> Entry1
    Entry1 --> Slider
    Entry1 --> Arrow
    Entry1 --> Dots
    Entry1 --> Track
    Entry1 --> Context
    Slider --> Auto
    Slider --> Touch
    Slider --> KeyNav
    Slider --> Hover
    Slider --> Resize
    Context --> Controls
    Context --> Visibility
    Slider --> CSSHandles
    Context -->|"dispatch view_promotion"| GA4

    click Manifest "https://github.com/vtex-apps/slider-layout/blob/master/manifest.json"
    click ContentSchemas "https://github.com/vtex-apps/slider-layout/blob/master/store/contentSchemas.json"
    click Interfaces "https://github.com/vtex-apps/slider-layout/blob/master/store/interfaces.json"
    click Messages "https://github.com/vtex-apps/slider-layout/tree/master/messages/"
    click Entry1 "https://github.com/vtex-apps/slider-layout/blob/master/react/SliderLayout.tsx"
    click Entry2 "https://github.com/vtex-apps/slider-layout/blob/master/react/SliderLayoutGroup.tsx"
    click Slider "https://github.com/vtex-apps/slider-layout/blob/master/react/components/Slider.tsx"
    click Arrow "https://github.com/vtex-apps/slider-layout/blob/master/react/components/Arrow.tsx"
    click Dots "https://github.com/vtex-apps/slider-layout/blob/master/react/components/PaginationDots.tsx"
    click Track "https://github.com/vtex-apps/slider-layout/blob/master/react/components/SliderTrack.tsx"
    click Context "https://github.com/vtex-apps/slider-layout/blob/master/react/components/SliderContext.tsx"
    click Auto "https://github.com/vtex-apps/slider-layout/blob/master/react/hooks/useAutoplay.ts"
    click Touch "https://github.com/vtex-apps/slider-layout/blob/master/react/hooks/useTouchHandlers.ts"
    click KeyNav "https://github.com/vtex-apps/slider-layout/blob/master/react/hooks/useKeyboardArrows.ts"
    click Hover "https://github.com/vtex-apps/slider-layout/blob/master/react/hooks/useHovering.ts"
    click Resize "https://github.com/vtex-apps/slider-layout/blob/master/react/hooks/useScreenResize.ts"
    click Controls "https://github.com/vtex-apps/slider-layout/blob/master/react/hooks/useSliderControls.ts"
    click Visibility "https://github.com/vtex-apps/slider-layout/blob/master/react/hooks/useSliderVisibility.ts"
    click CSSHandles "https://github.com/vtex-apps/slider-layout/blob/master/react/modules/cssHandles.ts"
    click Mocks "https://github.com/vtex-apps/slider-layout/tree/master/react/__mocks__/"
    click Fixtures "https://github.com/vtex-apps/slider-layout/tree/master/react/__fixtures__/"
    click Tests "https://github.com/vtex-apps/slider-layout/tree/master/react/__tests__/"
    click CI "https://github.com/vtex-apps/slider-layout/blob/master/.github/workflows/pull-request.yml"
    click Crowdin "https://github.com/vtex-apps/slider-layout/blob/master/crowdin.yml"
    click Changelog "https://github.com/vtex-apps/slider-layout/blob/master/CHANGELOG.md"

    class VTEXPlatform platform
    class SliderApp app
    class GA4 external

    classDef platform fill:#D6EAF8,stroke:#3498DB
    classDef app fill:#D5F5E3,stroke:#27AE60
    classDef external fill:#F5B7B1,stroke:#E74C3C
```
