diff --git a/app/View/Components/Card/Wrapper.php b/app/View/Components/Card/Wrapper.php index 9614d9a2..e57c1236 100644 --- a/app/View/Components/Card/Wrapper.php +++ b/app/View/Components/Card/Wrapper.php @@ -26,28 +26,36 @@ class Wrapper extends Component * * @return void */ - public function __construct(string $size = 'sm', string $type = 'default', ?string $margin = null, ?string $padding = null) + public function __construct( + string $size = 'sm', + string $type = 'default', + string|null $margin = null, + string|null $padding = null, + string $extraClasses = '', + ) { $this->size = $size; $this->type = $type; - if(isset($margin)) { + if (isset($margin)) { $this->margin = $margin; - } else if($this->type === 'transparent') { + } else if ($this->type === 'transparent') { $this->margin = ''; } else { $this->margin = 'my-4'; } - if(isset($padding)) { + if (isset($padding)) { $this->padding = $padding; - } else if($this->type === 'transparent') { + } else if ($this->type === 'transparent') { $this->padding = 'px-4'; } else { $this->padding = 'p-4'; } $this->classes = "relative {$this->margin} max-w-{$this->size} w-full z-30 {$this->padding} {$this->typeClasses[$this->type]}"; + + if (strlen($extraClasses) > 0) $this->classes .= " {$extraClasses}"; } /** diff --git a/app/View/Components/Post/Card.php b/app/View/Components/Post/Card.php index 15a04cec..4a084d37 100644 --- a/app/View/Components/Post/Card.php +++ b/app/View/Components/Post/Card.php @@ -12,11 +12,12 @@ class Card extends Component * Create a new component instance. */ public function __construct( - public Post $post, - public string $size = 'sm', - public string|null $margin = null, - public string|null $padding = null, - public readonly bool $livewire = false, + public Post $post, + public string $size = 'sm', + public string|null $margin = null, + public string|null $padding = null, + public readonly bool $livewire = false, + public readonly string $extraClasses = '', ) {} /** diff --git a/resources/views/components/post/card.blade.php b/resources/views/components/post/card.blade.php index 2aa926e4..300d603d 100644 --- a/resources/views/components/post/card.blade.php +++ b/resources/views/components/post/card.blade.php @@ -1,5 +1,5 @@ @php /** @var App\Models\Post $post */ @endphp - + @if($post->image) @if($this->hasPosts()) @foreach($posts as $post) - + @endforeach {{ $posts->links() }} @else