style updates
This commit is contained in:
@@ -1,12 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Builder\Components;
|
||||
|
||||
use Modules\Builder\Contracts\BuilderComponent;
|
||||
|
||||
final class ContentComponent implements BuilderComponent
|
||||
{
|
||||
public function type(): string { return 'content'; }
|
||||
public function label(): string { return 'Rich Content'; }
|
||||
public function category(): string { return 'Content'; }
|
||||
public function schema(): array { return ['content'=>['type'=>'textarea','required'=>true]]; }
|
||||
public function defaults(): array { return ['content'=>'<p>Add your content here.</p>']; }
|
||||
public function render(array $properties, array $context=[]): string { return (string)($properties['content']??''); }
|
||||
public function type(): string
|
||||
{
|
||||
return 'content';
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return 'Rich Content';
|
||||
}
|
||||
|
||||
public function category(): string
|
||||
{
|
||||
return 'Content';
|
||||
}
|
||||
|
||||
public function schema(): array
|
||||
{
|
||||
return ['content' => ['type' => 'textarea', 'required' => true]];
|
||||
}
|
||||
|
||||
public function defaults(): array
|
||||
{
|
||||
return ['content' => '<p>Add your content here.</p>'];
|
||||
}
|
||||
|
||||
public function render(array $properties, array $context = []): string
|
||||
{
|
||||
return (string) ($properties['content'] ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Builder\Components;
|
||||
|
||||
use Modules\Builder\Contracts\BuilderComponent;
|
||||
|
||||
final class HeadingComponent implements BuilderComponent
|
||||
{
|
||||
public function type(): string { return 'heading'; }
|
||||
public function label(): string { return 'Heading'; }
|
||||
public function category(): string { return 'Typography'; }
|
||||
public function schema(): array { return ['text'=>['type'=>'text','required'=>true],'level'=>['type'=>'select','options'=>[1,2,3,4,5,6]]]; }
|
||||
public function defaults(): array { return ['text'=>'Heading','level'=>2]; }
|
||||
public function render(array $properties, array $context=[]): string { $level=max(1,min(6,(int)($properties['level']??2))); return '<h'.$level.'>'.e($properties['text']??'').'</h'.$level.'>'; }
|
||||
public function type(): string
|
||||
{
|
||||
return 'heading';
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return 'Heading';
|
||||
}
|
||||
|
||||
public function category(): string
|
||||
{
|
||||
return 'Typography';
|
||||
}
|
||||
|
||||
public function schema(): array
|
||||
{
|
||||
return ['text' => ['type' => 'text', 'required' => true], 'level' => ['type' => 'select', 'options' => [1, 2, 3, 4, 5, 6]]];
|
||||
}
|
||||
|
||||
public function defaults(): array
|
||||
{
|
||||
return ['text' => 'Heading', 'level' => 2];
|
||||
}
|
||||
|
||||
public function render(array $properties, array $context = []): string
|
||||
{
|
||||
$level = max(1, min(6, (int) ($properties['level'] ?? 2)));
|
||||
|
||||
return '<h'.$level.'>'.e($properties['text'] ?? '').'</h'.$level.'>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Builder\Components;
|
||||
|
||||
use Modules\Builder\Contracts\BuilderComponent;
|
||||
|
||||
final class HeroComponent implements BuilderComponent
|
||||
{
|
||||
public function type(): string { return 'hero'; }
|
||||
public function label(): string { return 'Hero'; }
|
||||
public function category(): string { return 'Content'; }
|
||||
public function schema(): array { return ['heading'=>['type'=>'text','required'=>true],'content'=>['type'=>'textarea'],'button_label'=>['type'=>'text'],'button_url'=>['type'=>'text']]; }
|
||||
public function defaults(): array { return ['heading'=>'A compelling headline','content'=>'Add supporting content here.','button_label'=>'Learn more','button_url'=>'#']; }
|
||||
public function render(array $properties, array $context=[]): string { return view('builder::components.hero',['properties'=>$properties])->render(); }
|
||||
public function type(): string
|
||||
{
|
||||
return 'hero';
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return 'Hero';
|
||||
}
|
||||
|
||||
public function category(): string
|
||||
{
|
||||
return 'Content';
|
||||
}
|
||||
|
||||
public function schema(): array
|
||||
{
|
||||
return ['heading' => ['type' => 'text', 'required' => true], 'content' => ['type' => 'textarea'], 'button_label' => ['type' => 'text'], 'button_url' => ['type' => 'text']];
|
||||
}
|
||||
|
||||
public function defaults(): array
|
||||
{
|
||||
return ['heading' => 'A compelling headline', 'content' => 'Add supporting content here.', 'button_label' => 'Learn more', 'button_url' => '#'];
|
||||
}
|
||||
|
||||
public function render(array $properties, array $context = []): string
|
||||
{
|
||||
return view('builder::components.hero', ['properties' => $properties])->render();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user