Replies: 2 comments 5 replies
-
Thanks for the kind words! I'm not opposed to this being part of Core. The only reason I didn't PR it at the moment is that it 1) includes quite a complex dependency (https://github.com/stillat/blade-parser) and 2) didn't want to add additional moving pieces to the PR list while they worked on v4 🙂 |
Beta Was this translation helpful? Give feedback.
0 replies
-
I like to build my Blade components like this: @props([
'as' => 'button',
'style' => 'primary',
'size' => 'md',
])
@php
$shared = 'block font-semibold text-center shadow-sm';
$style = match ($style) {
'primary' => 'bg-teal-600 text-white hover:bg-teal-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-teal-600 dark:bg-teal-500 dark:hover:bg-teal-400 dark:focus-visible:outline-teal-500',
'cta' => 'bg-orange-600 text-white hover:bg-orange-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-orange-600 dark:bg-orange-500 dark:hover:bg-orange-400 dark:focus-visible:outline-orange-500',
};
$size = match ($size) {
'xs' => 'rounded px-2 py-1 text-xs',
'sm' => 'rounded px-2 py-1 text-sm',
'md' => 'rounded-md px-2.5 py-1.5 text-sm',
'lg' => 'rounded-md px-3 py-2 text-sm',
'xl' => 'rounded-md px-3.5 py-2.5 text-sm',
};
@endphp
<{{ $as }}
{{
$attributes->class([
$shared, $style, $size,
])
}}
>{{ $slot }}</{{ $as }}> I haven't found a good way to mimic this with just Antlers. Maybe you have some tip, seeing as you're the King of Antlers? 😁 |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I like Antlers in general, but making small reusable UI components always felt cumbersome for me. At least compared to Blade. This package lets me do those bits with Blade components (which I love!), and the rest with Antlers (which is amazingly integrated with Statamic). Fantastic!
Thank you! ❤️
Have you considered contributing this to Statamic core?
Beta Was this translation helpful? Give feedback.
All reactions