Skip to content

Commit

Permalink
Merge pull request #14592 from bezhanSalleh/patch/builder-block-preview
Browse files Browse the repository at this point in the history
[Forms] Builder Component Block Preview(s) Fixed/Enhanced
  • Loading branch information
danharrin authored Oct 22, 2024
2 parents 3b25f67 + a684c63 commit 5885c6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/forms/resources/views/components/builder.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ class="absolute inset-0 rotate-180 transition"
x-show="! isCollapsed"
@class([
'fi-fo-builder-item-content relative border-t border-gray-100 dark:border-white/10',
'p-4' => ! $hasBlockPreviews,
'p-4' => ! ($hasBlockPreviews && $item->getParentComponent()->hasPreview()),
])
>
@if ($hasBlockPreviews)
@if ($hasBlockPreviews && $item->getParentComponent()->hasPreview())
<div
@class([
'fi-fo-builder-item-preview',
Expand Down
5 changes: 5 additions & 0 deletions packages/forms/src/Components/Concerns/HasPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public function preview(string | Closure | null $preview): static
return $this;
}

public function hasPreview(): bool
{
return (bool) filled($this->evaluate($this->preview));
}

/**
* @param array<string, mixed> $data
*/
Expand Down

0 comments on commit 5885c6d

Please sign in to comment.