Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Very basic badge component #8

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

latachz
Copy link
Contributor

@latachz latachz commented May 3, 2024

Changes

It introduces the very initial version of Badge component with an optional glowing effect.

image

@zachallaun
Copy link

Drive-by comment that you both should feel free to take with a grain of salt:

The glow effect is neat but seems much more general than something that should appear on a component like a badge. It seems like it could be useful for many elements, including buttons, cards, etc. Is it possible to implement it in a way that composes with components instead of needing to modify every component that might possibly want it?

<.glow from_color="..." to_color="...">
  <.badge>Badge</.badge>
</.glow>

<.glow from_color="..." to_color="...">
  <.button>Button</.button>
</.glow>

This would also facilitate enhancing the effect later with modifiers for size, single color, etc.

@chrisgreg
Copy link
Owner

Drive-by comment that you both should feel free to take with a grain of salt:

The glow effect is neat but seems much more general than something that should appear on a component like a badge. It seems like it could be useful for many elements, including buttons, cards, etc. Is it possible to implement it in a way that composes with components instead of needing to modify every component that might possibly want it?

<.glow from_color="..." to_color="...">
  <.badge>Badge</.badge>
</.glow>

<.glow from_color="..." to_color="...">
  <.button>Button</.button>
</.glow>

This would also facilitate enhancing the effect later with modifiers for size, single color, etc.

I agree, Glow should be extracted out to be used on whatever a consumer wants. It shouldn't inherently be part of a badge.

@latachz
Copy link
Contributor Author

latachz commented May 4, 2024

Completely agree. I think we can start with simple badge without effect and extract glow from all the components😄

@latachz latachz changed the title feat: Very basic badge component with optional glow effect feat: Very basic badge component May 5, 2024
Comment on lines +8 to +14
attr(:variant, :string, doc: "Badge variant", default: "primary")

attr(:class, :string, default: "", doc: "Class for badge")
attr(:rest, :global)

slot(:inner_block, required: true)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great - but one usecase I always have for badges is for tags and those require lots of colour variations.

Can you think of a way we can make them easily customisable from their colours without defining a variation?
Maybe a variation called colour and another prop that sets the colour? Could be done well with pattern matching.

@chrisgreg
Copy link
Owner

Any update on the changes from my comment @latachz ?

@latachz
Copy link
Contributor Author

latachz commented Sep 11, 2024

Hi @chrisgreg. I didn't have time to handle that. Feel free to mark MR as closed and implement it on your own 🙏

@chrisgreg
Copy link
Owner

All good @latachz - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants