From 97ac7c2155c2623a09b1d7406a2f969d32f12900 Mon Sep 17 00:00:00 2001 From: Martin Ro Date: Tue, 1 Oct 2024 05:06:40 +0800 Subject: [PATCH 1/3] Hide label by default --- src/Components/FilamentBlockBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/FilamentBlockBuilder.php b/src/Components/FilamentBlockBuilder.php index 557e0de..42f3f3f 100644 --- a/src/Components/FilamentBlockBuilder.php +++ b/src/Components/FilamentBlockBuilder.php @@ -12,7 +12,7 @@ protected function setUp(): void { parent::setUp(); - $this->label(null); + $this->hiddenLabel(); $this->addActionLabel('Add Block'); From 111d5e2e5ce9e88084494e8a377262ad89654d00 Mon Sep 17 00:00:00 2001 From: Martin Ro Date: Tue, 1 Oct 2024 05:07:18 +0800 Subject: [PATCH 2/3] Adds props to view stub --- stubs/BlockView.stub | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stubs/BlockView.stub b/stubs/BlockView.stub index 7c10385..767ec58 100644 --- a/stubs/BlockView.stub +++ b/stubs/BlockView.stub @@ -1,3 +1,5 @@ +@props([]) +
//
From 87e7bd7248e46eabb2e319c9c85cd207467560de Mon Sep 17 00:00:00 2001 From: Martin Ro Date: Tue, 1 Oct 2024 05:23:35 +0800 Subject: [PATCH 3/3] Fixes label generation --- CHANGELOG.md | 8 ++++++++ README.md | 4 ++-- src/Commands/MakeBlockCommand.php | 7 +++++-- stubs/Block.stub | 2 +- stubs/BlockView.stub | 4 +++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10da465..f146825 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to `filament-blocks` will be documented in this file. +## 1.0.3 - 2024-10-01 + +- Hide the label of `FilamentBlockBuilder` by default +- Add a `@props` tag to the block view stub +- Replace the default icon with a Heroicon +- Fixed label generation +- Update README to reflect changes above + ## 1.0.2 - 2024-09-05 - Update README to include CHANGELOG reference diff --git a/README.md b/README.md index b74d6e5..5f18298 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ class MyHero extends FilamentBlock public static function getBlockSchema(): Block { return Block::make('hero.my-hero') - ->label('My Hero') - ->icon('phosphor-cards-three') + ->label('Hero: My Hero') + ->icon('heroicon-o-rectangle-stack') ->preview('components.blocks.hero.my-hero') ->schema([ // diff --git a/src/Commands/MakeBlockCommand.php b/src/Commands/MakeBlockCommand.php index ed2f7e7..126d292 100644 --- a/src/Commands/MakeBlockCommand.php +++ b/src/Commands/MakeBlockCommand.php @@ -20,7 +20,10 @@ final class MakeBlockCommand extends Command public function handle(): int { - $block = (string) Str::of($this->argument('name') ?? text(label: 'Name (e.g. `Hero`)', required: true)) + $block = (string) Str::of($this->argument('name') ?? text( + label: 'Name (e.g. `Hero`)', + required: true, + )) ->trim('/') ->trim('\\') ->trim(' ') @@ -34,7 +37,7 @@ public function handle(): int $label = Str::of($block) ->beforeLast('Block') ->explode('\\') - ->map(fn ($segment) => Str::title($segment)) + ->map(fn ($segment) => Str::studly($segment)) ->implode(': '); $shortName = Str::of($block) diff --git a/stubs/Block.stub b/stubs/Block.stub index 432c386..8d61a03 100644 --- a/stubs/Block.stub +++ b/stubs/Block.stub @@ -12,7 +12,7 @@ class {{ class }} extends FilamentBlock { return Block::make('{{ shortName }}') ->label('{{ label }}') - ->icon('phosphor-cards-three') + ->icon('heroicon-o-rectangle-stack') ->preview('{{ componentPath }}') ->schema([ // diff --git a/stubs/BlockView.stub b/stubs/BlockView.stub index 767ec58..5817d57 100644 --- a/stubs/BlockView.stub +++ b/stubs/BlockView.stub @@ -1,4 +1,6 @@ -@props([]) +@props([ + // +])
//