Files
MyClub/DOCS/ELEMENTOR_VISUAL_BUILDER.md
Tomáš Dvořák 12cba639b9 upload
2025-10-16 13:32:05 +02:00

10 KiB

🎨 Elementor Visual Builder - Complete Implementation

What's New

You asked for a full visual builder like the screenshot with:

  • Left sidebar with typography & color controls
  • Viewport switcher (Desktop, Tablet, Mobile)
  • Visual icons for all controls
  • Color pickers for backgrounds and text
  • Typography controls (font, size, weight, etc.)
  • Pre-populated elements showing intended order
  • Responsive preview with device frames

🎯 Complete Interface

Top Bar (Dark)

┌────────────────────────────────────────────────────────────┐
│ ⚽ ELEMENTOR     [🖥️ Desktop] [📱 Tablet] [📱 Mobile]    │
│ Homepage Editor                    [Publish] [X]          │
└────────────────────────────────────────────────────────────┘

Left Sidebar - Visual Style Panel

┌──────────────────┐
│ [Content] [Style]│
│  [Advanced]      │
├──────────────────┤
│ Typography       │
│ ┌──────────────┐ │
│ │ Font Family  │ │
│ │ [Inter ▼]    │ │
│ └──────────────┘ │
│ ┌──────────────┐ │
│ │ Size (px)    │ │
│ │ [16]    [+]  │ │
│ └──────────────┘ │
│ ┌──────────────┐ │
│ │ Weight       │ │
│ │ [━━━━●━━━━]  │ │
│ │ 400          │ │
│ └──────────────┘ │
│ Colors           │
│ ┌──────────────┐ │
│ │ Text Color   │ │
│ │ [●] #000000  │ │
│ └──────────────┘ │
│ ┌──────────────┐ │
│ │ Background   │ │
│ │ [●] #ffffff  │ │
│ └──────────────┘ │
└──────────────────┘

Center - Preview Area

┌────────────────────────────┐
│         [Preview]          │
│  ┌──────────────────────┐  │
│  │                      │  │ ← Desktop: Full width
│  │   Your Page Here     │  │ ← Tablet: 768px
│  │                      │  │ ← Mobile: 375px
│  └──────────────────────┘  │
└────────────────────────────┘

Right Sidebar - Layers Panel

┌────────────────┐
│ 🔄 Layers  [X] │
├────────────────┤
│ 📋 Header      │
│ 🎯 Hero        │
│ 📰 News        │
│ ⚽ Matches      │
│ 🤝 Sponsors    │
└────────────────┘

🎨 Visual Controls

Typography Tab

  • Font Family dropdown with 8 fonts
  • Font Size number input (8-128px)
  • Font Weight slider (100-900)
  • Line Height slider (0.5-3.0)
  • Letter Spacing slider (-5 to 10px)
  • Text Transform dropdown (none, uppercase, lowercase, capitalize)

Style Tab

  • Text Color color picker + hex input
  • Background Color color picker + hex input
  • Padding 4 inputs (T, R, B, L)
  • Margin 4 inputs (T, R, B, L)

Advanced Tab

  • Display dropdown (block, flex, grid, etc.)
  • Width text input (auto, %, px)
  • Height text input (auto, %, px)

📱 Viewport Switching

Desktop View (Default)

  • Width: 100% (full browser width)
  • Icon: 🖥️ Monitor
  • Use: Desktop editing

Tablet View

  • Width: 768px
  • Icon: 📱 Tablet
  • Shadow: 2xl (device frame effect)
  • Use: Tablet responsive testing

Mobile View

  • Width: 375px
  • Icon: 📱 Smartphone
  • Shadow: 2xl (phone frame effect)
  • Use: Mobile responsive testing

🎯 Pre-populated Elements

When you first open the editor, you'll see:

Visible Elements (5)

  1. Header 📋 - Site navigation
  2. Hero 🎯 - Main banner
  3. News 📰 - Latest articles
  4. Matches - Game schedules
  5. Sponsors 🤝 - Partner logos

Hidden Elements (5)

  1. Gallery 🖼️ - Photo gallery
  2. Videos 🎥 - Video section
  3. Team 👥 - Player roster
  4. Activities 📅 - Events calendar
  5. Newsletter ✉️ - Email signup

Total: 10 elements pre-configured!

🎨 How to Use

1. Open Visual Builder

1. Login as admin
2. Go to homepage
3. Click "Edit" button
4. ✨ Visual builder opens!

2. Select Element

1. Click any element on page
2. Left sidebar appears
3. Shows all style controls
4. Make changes in real-time!

3. Change Typography

1. Select element
2. Click "Content" tab
3. Change font to "Poppins"
4. Adjust size to 24px
5. Set weight to 700 (bold)
6. ✨ See changes instantly!

4. Change Colors

1. Select element
2. Click "Style" tab
3. Click text color picker
4. Choose new color
5. Click background picker
6. Choose new background
7. ✨ Beautiful colors!

5. Test Responsive

1. Click Tablet icon (top bar)
2. Preview shrinks to 768px
3. Click Mobile icon
4. Preview shrinks to 375px
5. Test all breakpoints!

6. Add/Remove Elements

1. Click "+ Add" button
2. Choose Gallery
3. Click Layers button
4. Hide/show any element
5. Reorder with ↑↓

🎯 Visual Workflow

Scenario: Style Homepage Header

Steps:

1. Click header element
2. Left sidebar opens automatically
3. Content Tab:
   - Font: Poppins
   - Size: 18px
   - Weight: 600
   - Transform: Uppercase
4. Style Tab:
   - Text Color: #ffffff (white)
   - Background: #1a202c (dark gray)
   - Padding Top: 20px
   - Padding Bottom: 20px
5. ✨ Header now styled!
6. Click "Publish" to save

Time: ~30 seconds Result: Professionally styled header

Scenario: Make Page Mobile-Friendly

Steps:

1. Click Mobile icon (top)
2. Preview switches to 375px
3. Click hero section
4. Style Tab:
   - Padding Left: 16px
   - Padding Right: 16px
   - Font Size: 24px (smaller)
5. Click news section
6. Content Tab:
   - Font Size: 14px
7. Test all sections
8. Click Desktop to verify
9. Click "Publish"

Time: ~2 minutes Result: Responsive mobile design

🎨 Design System

Color Palette

/* Top Bar */
background: #1a202c (gray.900)
accent: #9f7aea (purple.500)

/* Left Sidebar */
background: #ffffff (white)
borders: #e2e8f0 (gray.200)

/* Preview Area */
background: #f7fafc (gray.50)
content: #ffffff (white)

/* Right Sidebar */
background: #ffffff (white)
accent: #319795 (teal.500)

Typography System

/* Available Fonts */
- Inter (default)
- Roboto
- Open Sans
- Lato
- Montserrat
- Poppins
- Georgia
- Times New Roman

/* Font Weights */
100 - Thin
200 - Extra Light
300 - Light
400 - Regular
500 - Medium
600 - Semi Bold
700 - Bold
800 - Extra Bold
900 - Black

Spacing Scale

/* Padding/Margin Options */
0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64px

🚀 Technical Implementation

Viewport System

const getViewportWidth = () => {
  switch (viewport) {
    case 'mobile': return '375px';
    case 'tablet': return '768px';
    case 'desktop': return '100%';
  }
};

Style Changes

const handleStyleChange = (elementName, styles) => {
  // Update local state
  setElementStyles({
    ...elementStyles,
    [elementName]: styles
  });
  
  // Dispatch event for live preview
  window.dispatchEvent(new CustomEvent('elementor-style-change', {
    detail: { elementName, styles }
  }));
  
  // Mark as changed
  setHasChanges(true);
};

Live Preview

// Component listens for style changes
useEffect(() => {
  const handleStyleChange = (e: CustomEvent) => {
    const { elementName, styles } = e.detail;
    // Apply styles to element
    applyStylesToElement(elementName, styles);
  };
  
  window.addEventListener('elementor-style-change', handleStyleChange);
  return () => window.removeEventListener('elementor-style-change', handleStyleChange);
}, []);

📁 New Files

Created

  • VisualStylePanel.tsx - Left sidebar with controls (~450 lines)
  • defaultElements.ts - Pre-populated element config
  • ELEMENTOR_VISUAL_BUILDER.md - This documentation

Modified

  • ElementorStyleEditor.tsx - Integrated visual panel + viewport
  • Added viewport switcher to top bar
  • Added responsive preview container
  • Added default elements loading

Features Summary

Visual Controls

  • Typography panel (6 controls)
  • Color pickers (2 colors)
  • Spacing controls (8 inputs)
  • Layout controls (3 options)
  • Real-time preview
  • Tabbed interface

Responsive

  • Desktop view (100%)
  • Tablet view (768px)
  • Mobile view (375px)
  • Device frames
  • Smooth transitions

Pre-configured

  • 5 visible elements
  • 5 hidden elements
  • Logical order
  • Best practices
  • One-click publish

🎉 The Result

You now have a complete Elementor-style visual builder with:

  1. Full typography control - Fonts, sizes, weights, spacing
  2. Visual color pickers - See colors as you choose
  3. Responsive preview - Test all devices
  4. Pre-populated elements - See intended design
  5. Live changes - No reload needed
  6. Professional UI - Dark top bar, clean sidebars
  7. Icon-based controls - Visual and intuitive

It looks and works exactly like Elementor! 🎨

🚀 Try It Now!

# Already set up - just use it!

1. Go to homepage as admin
2. Click Edit button
3. ✨ Visual builder opens!
4. Click header
5. Left panel appears with ALL controls!
6. Change font to Poppins
7. Make it bold (700)
8. Pick a color
9. See it live!
10. Click tablet icon
11. Preview switches!
12. Click Publish
13. Done!

Welcome to your new visual page builder! 🎨