Charles 2d937229fb
Add Custom StatBlocks, Add Stats (#1027)
* add custom statblock

* add custom datablock

* Use real values, not placeholders

* More Changes

* remove unused var

* Remove old code

* Remove more

* Updates

* Add LineHeight

Changing the font size cut off the j/g and _

* Fix invisible console selection

Closes #874

* Add Missing to `offline` detection

* Use helper

* Update

* Removals

* Move to `SmallStatBlock`
2025-02-26 10:08:42 -05:00

49 lines
903 B
PHP

<?php
namespace App\Filament\Server\Components;
use Filament\Widgets\StatsOverviewWidget\Stat;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Contracts\View\View;
class SmallStatBlock extends Stat
{
protected string|Htmlable $label;
protected $value;
public function label(string|Htmlable $label): static
{
$this->label = $label;
return $this;
}
public function value($value): static
{
$this->value = $value;
return $this;
}
public function getLabel(): string|Htmlable
{
return $this->label;
}
public function getValue()
{
return value($this->value);
}
public function toHtml(): string
{
return $this->render()->render();
}
public function render(): View
{
return view('filament.components.server-small-data-block', $this->data());
}
}