filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
15.01k stars 2.43k forks source link

Adding dynamic $size to filament badge component #12784

Open tnylea opened 2 weeks ago

tnylea commented 2 weeks ago

In this PR I've added the badgeSize prop to the Icon Button component. This will allow the user the ability to modify the size of the badge by passing it through as a prop to the parent Icon Button component 👍

Let me know if you have any questions about this PR. Appreciate it.

tnylea commented 2 weeks ago

I've also added this prop to the default button component as well. Instead of hardcoding the badge as xs, this will allow the user to change the size of the badge from the button and icon-button component.

zepfietje commented 2 weeks ago

Could you share the use case for this, @tnylea? Also, please provide screenshots for all components with all badge sizes. 🙂 The current positioning has been fine-tuned to work with the current size, so we should make sure all cases are covered for any new combinations we add too.

tnylea commented 2 weeks ago

Thanks for the feedback guys.

I'll be adding this to the link component as well. I see that I need to make some layout modifications based on the size.

When we increase the badge size to an XL, it looks like it sits too low on the element.

CleanShot 2024-05-17 at 16 37 17@2x

So, I'll work to get this to show correctly for all sizes. Just wanted to keep you posted that this is on my radar and I'll work on getting this updated on the weekend or upcoming week.

I'll be sure to include screenshots of all elements and all sizes of the badge.

Hope you guys are having a great Friday!

Talk soon!

zepfietje commented 2 weeks ago

Yeah that's exactly what I meant. Thanks, Tony!

tnylea commented 1 week ago

Hey guys,

This PR should be good to go unless there is anything else you see on your end. I have made sure to merge the latest upstream/3.x with my branch as well.

Here is the screenshot of the original badge size from this PR:

CleanShot 2024-05-20 at 19 21 49@2x

This is for the icon-button, button, and link components. Here are the screenshots for sizes sm, md, and lg.

CleanShot 2024-05-20 at 19 22 12@2x CleanShot 2024-05-20 at 19 22 42@2x CleanShot 2024-05-20 at 19 23 09@2x

Let me know if these look good or if we need any other modifications :)

Appreciate it!

tnylea commented 1 week ago

Thanks @zepfietje, I'll be circling back around to this today 😉

tnylea commented 1 week ago

[!IMPORTANT]
I'm not sure why PHPStan tests are failing. They seem to be throwing an error on some of the files that I did not even change 🤷‍♂️ Any help on this would be appreciated 😊


Right you were @zepfietje, I needed to add some additional styles to the link badge in order to get it to look correct with all different sizes. I see that the options for badge size are xs, sm, and md. I guess if you pass lg or xl, it will use the same styles as md.

Here is how it looks right now.

CleanShot 2024-05-24 at 11 52 24@2x

CleanShot 2024-05-24 at 11 59 31@2x

CleanShot 2024-05-24 at 11 59 59@2x

The last one may look a little weird because I didn't add enough padding to the middle and bottom element, but you can see that the badges look good with all sizes.

I doubt that many people will use the md badge size on these elements because it does look a little large for that specific use-case, but I can definitely see users reaching for the sm badge size over the xs badge size, so it's good to have all these options.

Let me know if there's anything else you would like me to update and I can make those changes. Looking forward to getting this merged in 😉

Thanks! Talk to you soon.

tnylea commented 3 days ago

@zepfietje Tests seem to be passing now. Let me know if there's anything additional you want me to add to this one and I can make it happen.

Thanks! Look forward to hearing from you soon.

zepfietje commented 3 days ago

Perfect, thanks Tony! Will be reviewing and merging this next. 👍

tnylea commented 3 days ago

Great! Thanks @zepfietje 😊

dissto commented 2 days ago

Small change, big impact. Thank you. I have been needing proper spacing for my badges numerous times. I suppose now the "hacking" stops 👍💪