Skip to content

Commit

Permalink
fix: banner (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio authored Dec 6, 2024
1 parent 1a5fb0d commit 36c3fc0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions app/Filament/Admin/Resources/ElectionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Fieldset;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
Expand Down Expand Up @@ -160,7 +161,7 @@ public static function form(Form $form): Form
->columnSpanFull()
->nullable(),

TextInput::make('properties.alert')
RichEditor::make('properties.alert')
->label(__('app.field.alert'))
->columnSpanFull()
->nullable(),
Expand Down Expand Up @@ -224,7 +225,8 @@ public static function infolist(Infolist $infolist): Infolist

TextEntry::make('properties.alert')
->label(__('app.field.alert'))
->columnSpanFull(),
->columnSpanFull()
->html(),
]),

Infolists\Components\Section::make()
Expand Down
8 changes: 6 additions & 2 deletions app/View/Components/Election/Alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@

use App\Models\Election;
use Illuminate\Contracts\View\View;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Str;
use Illuminate\View\Component;

class Alert extends Component
{
public ?string $alert = null;
public ?HtmlString $alert = null;

public function __construct(Election $election)
{
$this->alert = data_get($election, 'properties.alert');
$this->alert = Str::of(data_get($election, 'properties.alert'))
->sanitizeHtml()
->toHtmlString();
}

public function shouldRender(): bool
Expand Down
4 changes: 1 addition & 3 deletions resources/views/components/alert.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<div {{ $attributes->class('p-4 rounded-md') }}>
<div class="prose text-black prose-a:font-bold prose-a:text-purple-700">
{{ $slot }}
</div>
{{ $slot }}
</div>

0 comments on commit 36c3fc0

Please sign in to comment.