Replies: 7 comments 10 replies
-
|
For the ability to define the html to render, it appears you can use the getIcon and set it as Htmlable and then return an html string, however, this does not seem to like if you return SVG's which makes sense. I was able to get it to display an image, but it still forces it to show the name of the brink along with forcing padding and other issues. I suspect I can solve most of that using CSS. Looking at the source, there does not appear to be a way to provide a category, or tags to allow for better grouping or more diverse searches. |
Beta Was this translation helpful? Give feedback.
-
|
What is the difference between a Category and a Tag in this context? |
Beta Was this translation helpful? Give feedback.
-
|
The way I am thinking about it is like this:
So for example, I could make a brick that looks like this class Hero extends Brick
{
use ScopesUploadsToTenant;
public static function getId(): string
{
return 'hero';
}
public static function getCategory(): string
{
return 'Content';
}
public static function getTags(): array
{
return [
'hero',
'banner',
'header',
'landing page',
'marketing',
];
}
public static function getIcon(): Heroicon
{
return Heroicon::OutlinedSparkles;
}
public static function toHtml(array $config, ?array $data = null): ?string
{
return view('mason.hero', $config)->render();
}
public static function configureBrickAction(Action $action): Action
{
return $action
->slideOver()
->schema([ ... ]);
}
}This way if the user searches for things like marketing, hero, or banner, this brick will show up. Instead of specifically having to search for hero because thats the name. |
Beta Was this translation helpful? Give feedback.
-
|
Ok. That makes sense. I'll see what I can do. I think the 'Category' should be a separate component though instead of registered on the brick itself, that way bricks can belong to different categories on different editor instances. Something like this when you register the bricks with the editor: ->bricks([
BrickGroup::make('Content')
->bricks([
Section::class,
Grid::class,
]),
LeadForm::class,
]) |
Beta Was this translation helpful? Give feedback.
-
|
Also is it possible to do soemthing like this for rendering the brick icons: @if (filled($brick::getIcon()) && $brick::getIcon() instanceof \Illuminate\Contracts\Support\Htmlable)
{!! $brick::getIcon()->toHtml() !!}
@elseif (filled($brick::getIcon()))
<x-filament::icon
:icon="$brick::getIcon()"
class="h-5 w-5 shrink-0"
/>
@endifI was having an issue with the brick not rendering right with the html when passing it into the |
Beta Was this translation helpful? Give feedback.
-
|
Ok. Just released 3.0.5 with I've made notes to get the Category and Tags implemented. Will get to them as soon as I can. Thanks for the feedback and suggestions. |
Beta Was this translation helpful? Give feedback.
-
|
That was easier than I thought. V3.1.0 has BrickGroup and tagging. Cheers.🍻 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I was curious if you ever thought about adding or if the following features exists.
Search would be useful to upate to be able to find bricks by category or tags.
The reason I ask, is I would like to be able to build a layout that looks something closer to the following
Beta Was this translation helpful? Give feedback.
All reactions