https://github.com/ritikrk96/react-flow-task
Interactive drag-and-drop board built with React Flow. Allows only valid Block A β Block B connections, custom context menu, and live preview.
https://github.com/ritikrk96/react-flow-task
drag-and-drop flow-editor frontend-task interaction-board react reactflow tailwind
Last synced: 5 months ago
JSON representation
Interactive drag-and-drop board built with React Flow. Allows only valid Block A β Block B connections, custom context menu, and live preview.
- Host: GitHub
- URL: https://github.com/ritikrk96/react-flow-task
- Owner: RitikRK96
- Created: 2025-06-25T14:13:54.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-06-25T14:59:56.000Z (8 months ago)
- Last Synced: 2025-08-30T15:04:29.004Z (5 months ago)
- Topics: drag-and-drop, flow-editor, frontend-task, interaction-board, react, reactflow, tailwind
- Language: JavaScript
- Homepage: https://ritik.lancway.com/
- Size: 227 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π React Flow Interaction Board
This project is a task-based implementation demonstrating the use of **React**, **React Flow**, **Tailwind CSS**, and **Vite** to build a clean and responsive drag-and-drop interaction board.
> β
**Live Demo:** [https://ritik.lancway.com](https://ritik.lancway.com)
---
## π Task Objectives
I was assigned a frontend developer task to build an interactive UI that fulfills the following:
- π¦ Show a draggable panel with `Block A` and `Block B`.
- π§² Allow dragging blocks into a central React Flow canvas.
- π Only allow valid connections: `Block A β Block B`.
- π« Prevent invalid connections like `Block B β Block A`.
- π±οΈ Show a custom context menu with βHello Worldβ on right-click.
---
## π― Additional Features Implemented
- π¨ Tailwind-styled blocks with color coding:
- Blue β Block A
- Green β Block B
- π Animated connections (visually enhance data flow)
- πΊοΈ MiniMap, Zoom Controls, and Background Grid
- π Deployed on Hostinger: [https://ritik.lancway.com](https://ritik.lancway.com)
---
## π Project Structure
```
src/
βββ components/
β βββ FlowCanvas.jsx // Main board & logic
β βββ BlockPanel.jsx // Right-side draggable block list
β βββ ContextMenu.jsx // Right-click menu
βββ constants/
β βββ blocks.js // JSON-style static block config
βββ utils/
β βββ connectionRules.js // Connection validation logic
βββ App.jsx
βββ main.jsx
βββ index.css
````
---
## π§ͺ Installation Steps
```bash
# Clone the repository
git clone https://github.com/RitikRK96/react-flow-task.git
cd react-flow-task
# Install dependencies
npm install
# Run the development server
npm run dev
````
---
## π₯οΈ How to Run the App
After running the app with `npm run dev`, visit:
π [http://localhost:5173](http://localhost:5173)
You can now drag Block A/B from the right panel into the canvas and connect A β B.
---
## π§ Summary of the Solution
The solution leverages React Flow for building node-based interactions and constraints. It includes a right-click custom context menu, strict connection validation (A β B only), and clean layout using TailwindCSS.
The board is responsive, includes animated edges, a MiniMap, and styled block nodes.
---
## π§± Notes on Design Decisions
* **React Flow** was used for its powerful node editor and custom connection handling.
* **TailwindCSS** allowed for fast prototyping and clean, utility-first styles.
* Separation of concerns was maintained by using:
* `components/` for UI logic
* `constants/` for static config
* `utils/` for business rules like connection validation
---
## πΌοΈ Project Outcome
### 1οΈβ£ Valid Connection (Block A β Block B)

---
### 2οΈβ£ Invalid Connection (Block B β Block A)

---
### 3οΈβ£ Right-click Context Menu

---