# mate-academy/layout_search-bar-airbnb architecture

> Architecture diagram of the GitHub repository mate-academy/layout_search-bar-airbnb, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mate-academy/layout_search-bar-airbnb
- Repository: https://github.com/mate-academy/layout_search-bar-airbnb

## Overview

##### Main Components
- Source Code: The heart of the project lies in the "src" directory. This includes the HTML (src/index.html), the CSS (src/style.css), images (src/images), and fonts (src/fonts). This component represents the view layer where the two search bars (big & small) are defined.
- Visual Assets: The images and fonts used in styling (with the additional requirement to use @font-face) are stored under “src/images” and “src/fonts” respectively.
- Testing & CI/CD: There is a dedicated setup for visual regression testing (BackstopJS configuration in backstopConfig.js and related assets in the backstop_data folder) and CI workflows (located in .github/workflows) which automatically run tests.
- Code Quality Tools: There is a suite of configurations for ESLint, Stylelint, Prettier, and BEM linting (as seen by file names like .bemlintrc.json, .eslintrc.js, .editorconfig, etc.). These ensure that the code adheres to specific style guides and consistency rules.
- Documentation & Guidelines: The README and checklist.md provide instructions and coding requirements ensuring the design matches the project’s mockup and overall guidelines.

##### Relationships and Interactions
- The “src” folder (frontend view) is the entry point where the static HTML and CSS are loaded. The assets (images and fonts) are tightly coupled with the presentation logic of the search bars.
- The configuration files (linting, formatting, etc.) interact with most of the source code ensuring style and behavioral consistency.
- BackstopJS acts as an automated mechanism for visual regression – it compares the current layout (as rendered by the HTML/CSS) with expected screenshots. The GitHub workflows automatically run these tests, ensuring continuous integration.
- There is a clear pathway: development (edit src files) → automated code quality checks (via ESLint/Stylelint/Prettier) → visual regression tests (using BackstopJS) → CI checks (via GitHub workflows).

##### Important Architectural Patterns/Design Principles
- Separation of Concerns: The project clearly separates presentation (HTML, CSS) from configuration and testing assets.
- Automated Testing: Incorporation of BackstopJS for visual testing and GitHub workflows for CI manifests an automated workflow.
- Consistency: The heavy use of code style and linting configurations ensures a uniform code base.
- Adherence to Design Guidelines: The project uses BEM for naming and styling (as indicated by the presence of BEM configuration files), ensuring modular and maintainable CSS.

##### Relevant Technologies and Frameworks
- Pure HTML & CSS for rendering the search bars.
- BackstopJS for visual regression testing.
- GitHub Actions (workflows) for automated testing.
- Various linting/formatting tools like ESLint, Prettier, Stylelint, etc., ensuring code quality.

##### Elements
- Nodes/Components:
- "Frontend UI" encapsulating src/index.html, src/style.css, src/images, src/fonts.
- "Testing & CI" representing BackstopJS (backstopConfig.js and backstop_data) and GitHub workflows.
- "Code Quality" tools that represent ESLint, Prettier, Stylelint, etc.
- "Documentation/Guidelines" linked to the README and checklist.
- From "Frontend UI" to "Testing & CI" to show that once the HTML/CSS is updated, visual tests are triggered.
- From "Frontend UI" to "Code Quality" to signify the applied linting and formatting rules.
- From "Code Quality" and "Documentation" to "Frontend UI" to indicate adherence to style guidelines.
- Presentation layer (perhaps in a cool blue),
- Testing/CI components (in a vibrant green),
- Code quality and style tools (in a neutral grey or orange).

- On one branch, detail the “Frontend Layer” where the HTML page is built with two search bar forms (making sure to indicate the attributes like data-qa="big", data-qa="small", and data-qa="keypress").
- On another branch, show the “Asset Management” including the fonts and images.
- Another branch should represent “Testing & CI” where the Backstop scripts and GitHub workflows are visualized.
- Finally, include a branch for “Code Quality & Configuration” where the linting, BEM, and formatting configuration files reside.

## Diagram (Mermaid)

```mermaid
flowchart TD
    P["Project"]:::project

    subgraph "Frontend UI"
        HTML["HTML (index.html)"]:::frontend
        CSS["CSS (style.css)"]:::frontend
        Images["Images"]:::frontend
        Fonts["Fonts"]:::frontend
    end

    subgraph "Testing & CI"
        Backstop["BackstopJS (backstopConfig.js)"]:::testing
        TestData["Test Data (backstop_data)"]:::testing
        Workflows["GitHub Workflows (.github/workflows)"]:::testing
    end

    subgraph "Code Quality & Configuration"
        ESLint["ESLint (.eslintrc.js)"]:::quality
        BEM["BEM (.bemlintrc.json)"]:::quality
        Editor["EditorConfig (.editorconfig)"]:::quality
        Prettier["Prettier (.prettierrc)"]:::quality
        Stylelint["Stylelint (.stylelintrc.js)"]:::quality
    end

    subgraph "Documentation & Guidelines"
        README["README (readme.md)"]:::doc
        Checklist["Checklist (checklist.md)"]:::doc
    end

    P --> HTML
    P --> Backstop
    P --> ESLint
    P --> README

    HTML -->|"triggers_visual_tests"| Backstop
    CSS -->|"applies_linting"| ESLint
    ESLint -->|"enforces_guidelines"| HTML
    README -->|"provides_guidelines"| HTML
    CSS -->|"uses_font_face"| Fonts

    classDef project fill:#FFF176,stroke:#FBC02D,stroke-width:2px
    classDef frontend fill:#BBDEFB,stroke:#1E88E5,stroke-width:2px
    classDef testing fill:#C8E6C9,stroke:#388E3C,stroke-width:2px
    classDef quality fill:#FFE0B2,stroke:#F57C00,stroke-width:2px
    classDef doc fill:#D1C4E9,stroke:#673AB7,stroke-width:2px

    click HTML "https://github.com/mate-academy/layout_search-bar-airbnb/blob/master/src/index.html"
    click CSS "https://github.com/mate-academy/layout_search-bar-airbnb/blob/master/src/style.css"
    click Images "https://github.com/mate-academy/layout_search-bar-airbnb/tree/master/src/images"
    click Fonts "https://github.com/mate-academy/layout_search-bar-airbnb/tree/master/src/fonts"
    click Backstop "https://github.com/mate-academy/layout_search-bar-airbnb/blob/master/backstopConfig.js"
    click TestData "https://github.com/mate-academy/layout_search-bar-airbnb/tree/master/backstop_data"
    click Workflows "https://github.com/mate-academy/layout_search-bar-airbnb/tree/master/.github/workflows"
    click ESLint "https://github.com/mate-academy/layout_search-bar-airbnb/blob/master/.eslintrc.js"
    click BEM "https://github.com/mate-academy/layout_search-bar-airbnb/blob/master/.bemlintrc.json"
    click Editor "https://github.com/mate-academy/layout_search-bar-airbnb/blob/master/.editorconfig"
    click Prettier "https://github.com/mate-academy/layout_search-bar-airbnb/blob/master/.prettierrc"
    click Stylelint "https://github.com/mate-academy/layout_search-bar-airbnb/blob/master/.stylelintrc.js"
    click README "https://github.com/mate-academy/layout_search-bar-airbnb/blob/master/readme.md"
    click Checklist "https://github.com/mate-academy/layout_search-bar-airbnb/blob/master/checklist.md"
```
