Skip to content

Commit 86b5c53

Browse files
lam0819github-actions[bot]
authored andcommitted
Fix styling
1 parent 5cc05c7 commit 86b5c53

3 files changed

Lines changed: 57 additions & 59 deletions

File tree

packages/inspirecms-visual-editor/src/Rendering/BlockRenderer.php

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function renderLayout(array $layoutData, array $context = []): HtmlString
3535
*/
3636
public function renderBlock(array $blockData, array $context = []): string
3737
{
38-
if (empty($blockData) || !isset($blockData['type'])) {
38+
if (empty($blockData) || ! isset($blockData['type'])) {
3939
return '';
4040
}
4141

@@ -51,7 +51,7 @@ public function renderBlock(array $blockData, array $context = []): string
5151
$blockType = $blockData['type'];
5252
$block = BlockRegistry::get($blockType);
5353

54-
if (!$block) {
54+
if (! $block) {
5555
return $this->renderUnknownBlock($blockData);
5656
}
5757

@@ -60,14 +60,14 @@ public function renderBlock(array $blockData, array $context = []): string
6060

6161
// Prepare children HTML
6262
$childrenHtml = '';
63-
if (!empty($blockData['children']) && is_array($blockData['children'])) {
63+
if (! empty($blockData['children']) && is_array($blockData['children'])) {
6464
$childrenHtml = $this->renderChildren($blockData['children'], $context);
6565
}
6666

6767
// Determine the view to use
6868
$viewName = $this->getBlockViewName($blockType);
6969

70-
if (!View::exists($viewName)) {
70+
if (! View::exists($viewName)) {
7171
return $this->renderFallback($blockData, $attributes, $childrenHtml);
7272
}
7373

@@ -128,26 +128,26 @@ protected function prepareAttributes(array $blockData, BlockInterface $block): a
128128
// Add CSS classes
129129
$classes = ['ve-block', "ve-block-{$blockData['type']}"];
130130

131-
if (!empty($settings['cssClass'])) {
131+
if (! empty($settings['cssClass'])) {
132132
$classes[] = $settings['cssClass'];
133133
}
134134

135-
if (!empty($settings['className'])) {
135+
if (! empty($settings['className'])) {
136136
$classes[] = $settings['className'];
137137
}
138138

139139
$attributes['class'] = implode(' ', array_filter($classes));
140140

141141
// Build inline styles
142142
$inlineStyles = $this->buildInlineStyles($styles);
143-
if (!empty($inlineStyles)) {
143+
if (! empty($inlineStyles)) {
144144
$attributes['style'] = $inlineStyles;
145145
}
146146

147147
// Add data attributes
148148
$attributes['data-block-type'] = $blockData['type'];
149149

150-
if (!empty($blockData['id'])) {
150+
if (! empty($blockData['id'])) {
151151
$attributes['data-block-id'] = $blockData['id'];
152152
}
153153

@@ -162,165 +162,165 @@ protected function buildInlineStyles(array $styles): string
162162
$cssProperties = [];
163163

164164
// Spacing
165-
if (!empty($styles['margin'])) {
165+
if (! empty($styles['margin'])) {
166166
$cssProperties[] = "margin: {$styles['margin']}";
167167
}
168-
if (!empty($styles['marginTop'])) {
168+
if (! empty($styles['marginTop'])) {
169169
$cssProperties[] = "margin-top: {$styles['marginTop']}";
170170
}
171-
if (!empty($styles['marginRight'])) {
171+
if (! empty($styles['marginRight'])) {
172172
$cssProperties[] = "margin-right: {$styles['marginRight']}";
173173
}
174-
if (!empty($styles['marginBottom'])) {
174+
if (! empty($styles['marginBottom'])) {
175175
$cssProperties[] = "margin-bottom: {$styles['marginBottom']}";
176176
}
177-
if (!empty($styles['marginLeft'])) {
177+
if (! empty($styles['marginLeft'])) {
178178
$cssProperties[] = "margin-left: {$styles['marginLeft']}";
179179
}
180180

181-
if (!empty($styles['padding'])) {
181+
if (! empty($styles['padding'])) {
182182
$cssProperties[] = "padding: {$styles['padding']}";
183183
}
184-
if (!empty($styles['paddingTop'])) {
184+
if (! empty($styles['paddingTop'])) {
185185
$cssProperties[] = "padding-top: {$styles['paddingTop']}";
186186
}
187-
if (!empty($styles['paddingRight'])) {
187+
if (! empty($styles['paddingRight'])) {
188188
$cssProperties[] = "padding-right: {$styles['paddingRight']}";
189189
}
190-
if (!empty($styles['paddingBottom'])) {
190+
if (! empty($styles['paddingBottom'])) {
191191
$cssProperties[] = "padding-bottom: {$styles['paddingBottom']}";
192192
}
193-
if (!empty($styles['paddingLeft'])) {
193+
if (! empty($styles['paddingLeft'])) {
194194
$cssProperties[] = "padding-left: {$styles['paddingLeft']}";
195195
}
196196

197197
// Background
198-
if (!empty($styles['backgroundColor'])) {
198+
if (! empty($styles['backgroundColor'])) {
199199
$cssProperties[] = "background-color: {$styles['backgroundColor']}";
200200
}
201-
if (!empty($styles['backgroundImage'])) {
201+
if (! empty($styles['backgroundImage'])) {
202202
$cssProperties[] = "background-image: url('{$styles['backgroundImage']}')";
203203
}
204-
if (!empty($styles['backgroundSize'])) {
204+
if (! empty($styles['backgroundSize'])) {
205205
$cssProperties[] = "background-size: {$styles['backgroundSize']}";
206206
}
207-
if (!empty($styles['backgroundPosition'])) {
207+
if (! empty($styles['backgroundPosition'])) {
208208
$cssProperties[] = "background-position: {$styles['backgroundPosition']}";
209209
}
210-
if (!empty($styles['backgroundRepeat'])) {
210+
if (! empty($styles['backgroundRepeat'])) {
211211
$cssProperties[] = "background-repeat: {$styles['backgroundRepeat']}";
212212
}
213213

214214
// Border
215-
if (!empty($styles['borderWidth'])) {
215+
if (! empty($styles['borderWidth'])) {
216216
$cssProperties[] = "border-width: {$styles['borderWidth']}";
217217
}
218-
if (!empty($styles['borderStyle'])) {
218+
if (! empty($styles['borderStyle'])) {
219219
$cssProperties[] = "border-style: {$styles['borderStyle']}";
220220
}
221-
if (!empty($styles['borderColor'])) {
221+
if (! empty($styles['borderColor'])) {
222222
$cssProperties[] = "border-color: {$styles['borderColor']}";
223223
}
224-
if (!empty($styles['borderRadius'])) {
224+
if (! empty($styles['borderRadius'])) {
225225
$cssProperties[] = "border-radius: {$styles['borderRadius']}";
226226
}
227227

228228
// Typography
229-
if (!empty($styles['color'])) {
229+
if (! empty($styles['color'])) {
230230
$cssProperties[] = "color: {$styles['color']}";
231231
}
232-
if (!empty($styles['fontSize'])) {
232+
if (! empty($styles['fontSize'])) {
233233
$cssProperties[] = "font-size: {$styles['fontSize']}";
234234
}
235-
if (!empty($styles['fontWeight'])) {
235+
if (! empty($styles['fontWeight'])) {
236236
$cssProperties[] = "font-weight: {$styles['fontWeight']}";
237237
}
238-
if (!empty($styles['fontFamily'])) {
238+
if (! empty($styles['fontFamily'])) {
239239
$cssProperties[] = "font-family: {$styles['fontFamily']}";
240240
}
241-
if (!empty($styles['lineHeight'])) {
241+
if (! empty($styles['lineHeight'])) {
242242
$cssProperties[] = "line-height: {$styles['lineHeight']}";
243243
}
244-
if (!empty($styles['letterSpacing'])) {
244+
if (! empty($styles['letterSpacing'])) {
245245
$cssProperties[] = "letter-spacing: {$styles['letterSpacing']}";
246246
}
247-
if (!empty($styles['textAlign'])) {
247+
if (! empty($styles['textAlign'])) {
248248
$cssProperties[] = "text-align: {$styles['textAlign']}";
249249
}
250-
if (!empty($styles['textTransform'])) {
250+
if (! empty($styles['textTransform'])) {
251251
$cssProperties[] = "text-transform: {$styles['textTransform']}";
252252
}
253-
if (!empty($styles['textDecoration'])) {
253+
if (! empty($styles['textDecoration'])) {
254254
$cssProperties[] = "text-decoration: {$styles['textDecoration']}";
255255
}
256256

257257
// Layout
258-
if (!empty($styles['width'])) {
258+
if (! empty($styles['width'])) {
259259
$cssProperties[] = "width: {$styles['width']}";
260260
}
261-
if (!empty($styles['maxWidth'])) {
261+
if (! empty($styles['maxWidth'])) {
262262
$cssProperties[] = "max-width: {$styles['maxWidth']}";
263263
}
264-
if (!empty($styles['minWidth'])) {
264+
if (! empty($styles['minWidth'])) {
265265
$cssProperties[] = "min-width: {$styles['minWidth']}";
266266
}
267-
if (!empty($styles['height'])) {
267+
if (! empty($styles['height'])) {
268268
$cssProperties[] = "height: {$styles['height']}";
269269
}
270-
if (!empty($styles['maxHeight'])) {
270+
if (! empty($styles['maxHeight'])) {
271271
$cssProperties[] = "max-height: {$styles['maxHeight']}";
272272
}
273-
if (!empty($styles['minHeight'])) {
273+
if (! empty($styles['minHeight'])) {
274274
$cssProperties[] = "min-height: {$styles['minHeight']}";
275275
}
276276

277277
// Flexbox
278-
if (!empty($styles['display'])) {
278+
if (! empty($styles['display'])) {
279279
$cssProperties[] = "display: {$styles['display']}";
280280
}
281-
if (!empty($styles['flexDirection'])) {
281+
if (! empty($styles['flexDirection'])) {
282282
$cssProperties[] = "flex-direction: {$styles['flexDirection']}";
283283
}
284-
if (!empty($styles['justifyContent'])) {
284+
if (! empty($styles['justifyContent'])) {
285285
$cssProperties[] = "justify-content: {$styles['justifyContent']}";
286286
}
287-
if (!empty($styles['alignItems'])) {
287+
if (! empty($styles['alignItems'])) {
288288
$cssProperties[] = "align-items: {$styles['alignItems']}";
289289
}
290-
if (!empty($styles['flexWrap'])) {
290+
if (! empty($styles['flexWrap'])) {
291291
$cssProperties[] = "flex-wrap: {$styles['flexWrap']}";
292292
}
293-
if (!empty($styles['gap'])) {
293+
if (! empty($styles['gap'])) {
294294
$cssProperties[] = "gap: {$styles['gap']}";
295295
}
296296

297297
// Grid
298-
if (!empty($styles['gridTemplateColumns'])) {
298+
if (! empty($styles['gridTemplateColumns'])) {
299299
$cssProperties[] = "grid-template-columns: {$styles['gridTemplateColumns']}";
300300
}
301-
if (!empty($styles['gridTemplateRows'])) {
301+
if (! empty($styles['gridTemplateRows'])) {
302302
$cssProperties[] = "grid-template-rows: {$styles['gridTemplateRows']}";
303303
}
304-
if (!empty($styles['gridGap'])) {
304+
if (! empty($styles['gridGap'])) {
305305
$cssProperties[] = "grid-gap: {$styles['gridGap']}";
306306
}
307307

308308
// Effects
309-
if (!empty($styles['boxShadow'])) {
309+
if (! empty($styles['boxShadow'])) {
310310
$cssProperties[] = "box-shadow: {$styles['boxShadow']}";
311311
}
312-
if (!empty($styles['opacity'])) {
312+
if (! empty($styles['opacity'])) {
313313
$cssProperties[] = "opacity: {$styles['opacity']}";
314314
}
315-
if (!empty($styles['overflow'])) {
315+
if (! empty($styles['overflow'])) {
316316
$cssProperties[] = "overflow: {$styles['overflow']}";
317317
}
318-
if (!empty($styles['zIndex'])) {
318+
if (! empty($styles['zIndex'])) {
319319
$cssProperties[] = "z-index: {$styles['zIndex']}";
320320
}
321321

322322
// Position
323-
if (!empty($styles['position'])) {
323+
if (! empty($styles['position'])) {
324324
$cssProperties[] = "position: {$styles['position']}";
325325
}
326326
if (isset($styles['top'])) {

packages/inspirecms-visual-editor/src/VisualEditorServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use SolutionForest\InspireCmsVisualEditor\AI\Providers\OpenAIProvider;
1515
use SolutionForest\InspireCmsVisualEditor\AI\Services\LayoutGeneratorService;
1616
use SolutionForest\InspireCmsVisualEditor\Blocks\Registry\BlockRegistry;
17-
use SolutionForest\InspireCmsVisualEditor\Rendering\BlockRenderer;
1817
use SolutionForest\InspireCmsVisualEditor\Blocks\Types\ButtonBlock;
1918
use SolutionForest\InspireCmsVisualEditor\Blocks\Types\ColumnBlock;
2019
use SolutionForest\InspireCmsVisualEditor\Blocks\Types\ContainerBlock;
@@ -30,6 +29,7 @@
3029
use SolutionForest\InspireCmsVisualEditor\Livewire\LayersPanel;
3130
use SolutionForest\InspireCmsVisualEditor\Livewire\SettingsPanel;
3231
use SolutionForest\InspireCmsVisualEditor\Livewire\VisualEditor;
32+
use SolutionForest\InspireCmsVisualEditor\Rendering\BlockRenderer;
3333
use Spatie\LaravelPackageTools\Package;
3434
use Spatie\LaravelPackageTools\PackageServiceProvider;
3535

packages/inspirecms-visual-editor/src/helpers.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*
1010
* @param array $layoutData The layout data (JSON decoded)
1111
* @param array $context Additional context to pass to block templates
12-
* @return HtmlString
1312
*/
1413
function render_visual_layout(array $layoutData, array $context = []): HtmlString
1514
{
@@ -26,7 +25,6 @@ function render_visual_layout(array $layoutData, array $context = []): HtmlStrin
2625
*
2726
* @param array $blockData The block data
2827
* @param array $context Additional context to pass to block template
29-
* @return string
3028
*/
3129
function render_visual_block(array $blockData, array $context = []): string
3230
{

0 commit comments

Comments
 (0)