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

Let users pass through 'slots' for custom icons #1

Closed
aFuzzyBear opened this issue Jan 2, 2023 · 3 comments
Closed

Let users pass through 'slots' for custom icons #1

aFuzzyBear opened this issue Jan 2, 2023 · 3 comments

Comments

@aFuzzyBear
Copy link

Hey paji, I really like what you have done with this set of components,

But I was thinking it might be a bit better for the DX if we could pass in as a slot another Icon that they would like to use or even leverage astro-icon in the background to then let users just pass in via prop the name of the icon they want to consume.

This is a great component, I really do like how you have composed this.

<svg
fill="currentColor"
class:list={[className]}
width="24"
height="24"
viewBox="0 0 20 20"
xmlns="https://www.w3.org/2000/svg">
<title>Menu</title>
<path
class="astronav-toggle hidden"
fill-rule="evenodd"
clip-rule="evenodd"
d="M18.278 16.864a1 1 0 01-1.414 1.414l-4.829-4.828-4.828 4.828a1 1 0 01-1.414-1.414l4.828-4.829-4.828-4.828a1 1 0 011.414-1.414l4.829 4.828 4.828-4.828a1 1 0 111.414 1.414l-4.828 4.829 4.828 4.828z"
></path>
<path
class="astronav-toggle"
fill-rule="evenodd"
d="M4 5h16a1 1 0 010 2H4a1 1 0 110-2zm0 6h16a1 1 0 010 2H4a1 1 0 010-2zm0 6h16a1 1 0 010 2H4a1 1 0 010-2z"
></path>
</svg>

@surjithctly
Copy link
Owner

surjithctly commented Jan 2, 2023

Great idea. I should also add a logic here to support close icon as well. As you can see its bit clever here 😀

Maybe something like this. Default can be empty to use the current one.

<MenuIcons>
   <OpenIcon><svg/></OpenIcon>
   <CloseIcon><svg/></CloseIcon>
</MenuIcons>

@aFuzzyBear
Copy link
Author

Aye that would be alot better for the DX

@surjithctly
Copy link
Owner

Done :)

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

No branches or pull requests

2 participants