frontblocks-edge-alignment-frontend.js
7 months ago
frontblocks-edge-alignment-option.jsx
1 month ago
frontblocks-edge-alignment.css
1 month ago
frontblocks-edge-alignment.js
1 month ago
frontblocks-edge-alignment.css
135 lines
| 1 | /** |
| 2 | * Container Edge Alignment Styles |
| 3 | * |
| 4 | * Editor and frontend styles for edge alignment feature. |
| 5 | */ |
| 6 | |
| 7 | /* =========================== |
| 8 | EDITOR STYLES |
| 9 | =========================== */ |
| 10 | |
| 11 | .frbl-edge-alignment-panel .frbl-edge-alignment-description { |
| 12 | font-size: 12px; |
| 13 | color: #757575; |
| 14 | margin: 0 0 16px 0; |
| 15 | line-height: 1.4; |
| 16 | } |
| 17 | |
| 18 | .frbl-edge-alignment-panel .components-base-control { |
| 19 | margin-bottom: 16px; |
| 20 | } |
| 21 | |
| 22 | .frbl-edge-alignment-panel .components-base-control__help { |
| 23 | font-size: 11px; |
| 24 | color: #757575; |
| 25 | margin-top: 4px; |
| 26 | } |
| 27 | |
| 28 | /* Visual feedback in editor */ |
| 29 | .editor-styles-wrapper .frbl-edge-left { |
| 30 | position: relative; |
| 31 | } |
| 32 | |
| 33 | .editor-styles-wrapper .frbl-edge-left::before { |
| 34 | content: ''; |
| 35 | position: absolute; |
| 36 | left: 0; |
| 37 | top: 0; |
| 38 | bottom: 0; |
| 39 | width: 3px; |
| 40 | background: #2271b1; |
| 41 | z-index: 1; |
| 42 | opacity: 0.6; |
| 43 | } |
| 44 | |
| 45 | .editor-styles-wrapper .frbl-edge-right { |
| 46 | position: relative; |
| 47 | } |
| 48 | |
| 49 | .editor-styles-wrapper .frbl-edge-right::after { |
| 50 | content: ''; |
| 51 | position: absolute; |
| 52 | right: 0; |
| 53 | top: 0; |
| 54 | bottom: 0; |
| 55 | width: 3px; |
| 56 | background: #2271b1; |
| 57 | z-index: 1; |
| 58 | opacity: 0.6; |
| 59 | } |
| 60 | |
| 61 | /* =========================== |
| 62 | FRONTEND STYLES |
| 63 | =========================== */ |
| 64 | |
| 65 | /* |
| 66 | * Edge Alignment Styles |
| 67 | * |
| 68 | * The actual margin/width calculations are done via JavaScript |
| 69 | * (see frontblocks-edge-alignment-frontend.js) because CSS variables |
| 70 | * are not available in GeneratePress by default. |
| 71 | * |
| 72 | * JavaScript calculates: |
| 73 | * 1. Original container width (e.g., 1400px) |
| 74 | * 2. Side margin = (100vw - containerWidth) / 2 |
| 75 | * 3. Applies inline styles to fix one side and extend the other |
| 76 | */ |
| 77 | |
| 78 | /* |
| 79 | * Remove LEFT padding - extends to left edge |
| 80 | * (JavaScript will set: marginLeft=0, marginRight=calculated, width=calculated) |
| 81 | */ |
| 82 | .frbl-edge-left { |
| 83 | padding-left: 0 !important; |
| 84 | } |
| 85 | |
| 86 | /* |
| 87 | * Remove RIGHT padding - extends to right edge |
| 88 | * (JavaScript will set: marginRight=0, marginLeft=calculated, width=calculated) |
| 89 | */ |
| 90 | .frbl-edge-right { |
| 91 | padding-right: 0 !important; |
| 92 | } |
| 93 | |
| 94 | /* Ensure child elements respect the edge alignment — GenerateBlocks */ |
| 95 | .frbl-edge-left > .gb-container, |
| 96 | .frbl-edge-left > .gb-grid-wrapper, |
| 97 | .frbl-edge-left > .gb-inside-container { |
| 98 | padding-left: 0 !important; |
| 99 | margin-left: 0 !important; |
| 100 | } |
| 101 | |
| 102 | .frbl-edge-right > .gb-container, |
| 103 | .frbl-edge-right > .gb-grid-wrapper, |
| 104 | .frbl-edge-right > .gb-inside-container { |
| 105 | padding-right: 0 !important; |
| 106 | margin-right: 0 !important; |
| 107 | } |
| 108 | |
| 109 | /* Ensure child elements respect the edge alignment — native core blocks */ |
| 110 | .frbl-edge-left > .wp-block-group__inner-container, |
| 111 | .frbl-edge-left > .wp-block-columns { |
| 112 | padding-left: 0 !important; |
| 113 | margin-left: 0 !important; |
| 114 | } |
| 115 | |
| 116 | .frbl-edge-right > .wp-block-group__inner-container, |
| 117 | .frbl-edge-right > .wp-block-columns { |
| 118 | padding-right: 0 !important; |
| 119 | margin-right: 0 !important; |
| 120 | } |
| 121 | |
| 122 | /* Media query for responsive behavior */ |
| 123 | @media (max-width: 768px) { |
| 124 | /* Keep the edge alignment on mobile by default */ |
| 125 | /* Uncomment below to restore normal padding on mobile if needed */ |
| 126 | /* |
| 127 | .frbl-edge-left, |
| 128 | .frbl-edge-right { |
| 129 | padding-left: var(--gb-spacing-mobile, 20px) !important; |
| 130 | padding-right: var(--gb-spacing-mobile, 20px) !important; |
| 131 | } |
| 132 | */ |
| 133 | } |
| 134 | |
| 135 |