Skip to content

Commit 940bfb9

Browse files
authored
Refactor SVG handling for loading indicator
Refactor loading indicator SVG handling to use a custom SVG if configured otherwise use default SVG. Signed-off-by: Shaharyar Ahmed <shery.codes@gmail.com>
1 parent d30efb2 commit 940bfb9

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/support/src/helpers.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ function generate_loading_indicator_html(?ComponentAttributeBag $attributes = nu
206206
"fi-size-{$size->value}",
207207
]);
208208

209-
return new HtmlString(<<<HTML
209+
$defaultSvg = <<<HTML
210210
<svg
211211
fill="none"
212212
viewBox="0 0 24 24"
@@ -225,7 +225,15 @@ function generate_loading_indicator_html(?ComponentAttributeBag $attributes = nu
225225
fill="currentColor"
226226
></path>
227227
</svg>
228-
HTML);
228+
HTML;
229+
230+
$svg = config('filament.loading_indicator_svg');
231+
232+
if ($svg) {
233+
return new HtmlString(str_replace('__attributes__', $attributes->toHtml(), $svg));
234+
}
235+
236+
return new HtmlString($defaultSvg);
229237
}
230238
}
231239

0 commit comments

Comments
 (0)