VÀ CHÈN CSS TÙY CHỈNH QUA @PUSH('STYLES') / @STACK('STYLES') */ function renderBladeButton( string $label, string $variant = 'primary', string $size = 'md', ?string $icon = null, string $type = 'button', string $extraClass = '' ): string { $sizeClass = match ($size) { 'sm' => 'btn-sm', 'lg' => 'btn-lg', default => '', }; $iconHtml = $icon ? '' : ''; $classes = trim("btn btn-{$variant} {$sizeClass} d-inline-flex align-items-center gap-1 {$extraClass}"); return sprintf( '', htmlspecialchars($type), htmlspecialchars($classes), $iconHtml, htmlspecialchars($label) ); } $pushCustomStyles = isset($_GET['push_styles']) ? (bool) $_GET['push_styles'] : true; $btnBladeCode = file_get_contents(__DIR__ . '/../resources/views/components/button.blade.php'); $btnClassCode = file_get_contents(__DIR__ . '/../app/View/Components/Button.php'); ?>
@push('styles')
<style>
.btn { border-radius: 999px; transition: all .25s ease; }
</style>
@endpush
<x-button type="submit" variant="primary" size="md" icon="bi-check2-circle">
Lưu bài viết
</x-button>
= htmlspecialchars($btnBladeCode) ?>
= htmlspecialchars($btnClassCode) ?>