|
| 1 | +# ReactEdge – Banner Widget |
| 2 | + |
| 3 | +A small, embeddable **Banner (Unique Selling Points) widget** designed to be safely integrated into existing websites without owning the page or application lifecycle. |
| 4 | + |
| 5 | +This widget is part of the **ReactEdge** initiative: a collection of frontend widgets built with a strong emphasis on isolation, reversibility, and clarity. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## What this is |
| 10 | + |
| 11 | +- A lightweight frontend widget for displaying Banners |
| 12 | +- Designed to be embedded into existing platforms (e.g. legacy CMS, e-commerce sites) |
| 13 | +- Isolated by default (no global CSS or JS leakage) |
| 14 | +- Easy to install **and easy to remove** |
| 15 | +- Actively used and evolving |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## What this is NOT |
| 20 | + |
| 21 | +- ❌ A framework |
| 22 | +- ❌ A full design system |
| 23 | +- ❌ A conversion or growth “hack” |
| 24 | +- ❌ A replacement for CMS or backend logic |
| 25 | +- ❌ Opinionated about content or marketing strategy |
| 26 | + |
| 27 | +This widget focuses on **delivery and safety**, not business promises. |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Design principles |
| 32 | + |
| 33 | +- **Isolation first** – the widget does not assume ownership of the page or application |
| 34 | +- **Reversible by design** – removal should leave no trace on the host system |
| 35 | +- **Non-hostile to the host** – designed to coexist with existing themes and layouts rather than override them |
| 36 | +- **Minimal surface area** – only what is required to do the job |
| 37 | +- **Testable in isolation** – behaviour can be verified without the host platform |
| 38 | +- **Deferred by default** – does not require early page execution to function |
| 39 | +- **Layered structure** – organised to encourage consistency across ReactEdge widgets without enforcing a framework |
| 40 | +- **Boring on purpose** – clarity over cleverness |
| 41 | +- **Observable by the host** – key lifecycle and interaction events are emitted to allow integration with analytics or monitoring tools without coupling to a specific provider |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## Project structure (high level) |
| 46 | + |
| 47 | +This repository contains the widget itself, along with supporting tooling used for development, testing, and community maintenance. |
| 48 | + |
| 49 | +- `vite_project/` |
| 50 | + Source code for the Banner widget and its build configuration. |
| 51 | + |
| 52 | +- `tests/` |
| 53 | + End-to-end tests (Playwright) used to validate widget behaviour in a real browser environment. |
| 54 | + |
| 55 | +- `docker/` and `docker-compose.yml` |
| 56 | + Optional local development tooling. These are provided for convenience and are not required to use the widget. |
| 57 | + |
| 58 | +- `.github/` |
| 59 | + GitHub metadata (issue templates, CI workflows, etc.) to support collaboration and maintainability. |
| 60 | + |
| 61 | +- `www/` |
| 62 | + Generated build output. This folder is intentionally not committed to the repository. |
| 63 | + |
| 64 | +## Installation (high level) |
| 65 | + |
| 66 | +The widget is delivered as a standalone JavaScript file and exposed via a custom element. |
| 67 | + |
| 68 | +Typical usage looks like: |
| 69 | + |
| 70 | +```html |
| 71 | +<script src="path-to-widget.js"></script> |
| 72 | + |
| 73 | +<reactedge-banner-widget></reactedge-banner-widget> |
| 74 | +``` |
| 75 | + |
| 76 | +## Local development |
| 77 | + |
| 78 | +This project uses Node.js and npm. |
| 79 | + |
| 80 | +From the repository root: |
| 81 | + |
| 82 | +```bash |
| 83 | +npm install |
| 84 | +``` |
| 85 | + |
| 86 | +To run the widget locally: |
| 87 | + |
| 88 | +```bash |
| 89 | +cd vite_project |
| 90 | +npm install |
| 91 | +npm run dev |
| 92 | +``` |
| 93 | + |
| 94 | +To run the test suite: |
| 95 | +```bash |
| 96 | +npx playwright test --config=tests/playwright.dev.config.ts |
| 97 | +``` |
| 98 | + |
| 99 | +## Deploying the widget |
| 100 | + |
| 101 | +ReactEdge widgets are deployed as **static JavaScript artefacts**. |
| 102 | +They do not require a server-side runtime once built. |
| 103 | + |
| 104 | +### Build the artefact |
| 105 | + |
| 106 | +From the `vite_project` directory: |
| 107 | + |
| 108 | +```bash |
| 109 | +npm run build |
| 110 | +``` |
| 111 | + |
| 112 | +This produces a versioned JavaScript file in the www/ directory |
| 113 | +(e.g. widget-banner@x.y.z.iife.js). |
| 114 | + |
| 115 | +The www/ Generated build output produced by the build process. This folder is intentionally not committed to the repository. |
| 116 | + |
| 117 | +## CSS Isolation |
| 118 | + |
| 119 | +ReactEdge widgets use PostCSS prefixing to guarantee style isolation |
| 120 | +when embedded into hostile environments such as WordPress or Magento. |
| 121 | + |
| 122 | +All selectors are automatically scoped to a widget-specific root class. |
| 123 | + |
| 124 | +### Example: |
| 125 | +Source CSS: |
| 126 | +```bash |
| 127 | +.slide { ... } |
| 128 | +``` |
| 129 | +Production output: |
| 130 | +```bash |
| 131 | +.reactedge-banner .slide { ... } |
| 132 | +``` |
| 133 | +
|
| 134 | +This prevents collisions with host themes or other plugins. |
0 commit comments