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

Added icon support to KBar #137

Merged
merged 2 commits into from
Sep 20, 2023
Merged

Added icon support to KBar #137

merged 2 commits into from
Sep 20, 2023

Conversation

PranavRayudu
Copy link
Contributor

Added icon support to KBar. Works with strings, inline svgs, and imported icons and with all optional fields.

image

@changeset-bot
Copy link

changeset-bot bot commented Sep 19, 2023

🦋 Changeset detected

Latest commit: e9bcff8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
pliny Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@PranavRayudu
Copy link
Contributor Author

PranavRayudu commented Sep 19, 2023

Fixes #136

@timlrx
Copy link
Owner

timlrx commented Sep 20, 2023

Thanks, can you align the spacing? Might need to fix the icon size
CleanShot 2023-09-20 at 11 39 54

@PranavRayudu
Copy link
Contributor Author

PranavRayudu commented Sep 20, 2023

The alignment issue came up because I was using FontAwesome for the first icon, embedded HeroIcons svg for the second, and FontAwesome again for the third. Had I stayed consistent with the libraries, they would have been lined up properly. I attached a picture of my site to show what just using FontAwesome would look like with smaller icons.

image

And sample code for the socials section

const socials: Action[] = [
    {
      id: siteMetadata.email,
      name: 'Email',
      section: socialSection,
      perform: () => {},
      icon: <FontAwesomeIcon icon={faEnvelope} fixedWidth className={'text-xs'} />,
    },
    {
      id: siteMetadata.github,
      name: 'Github',
      section: socialSection,
      perform: () => window.open(siteMetadata.github, '_blank'),
      icon: <FontAwesomeIcon icon={faGithub} fixedWidth className={'text-xs'} />,
    },
    {
      id: siteMetadata.linkedin,
      name: 'LinkedIn',
      section: socialSection,
      perform: () => window.open(siteMetadata.linkedin, '_blank'),
      icon: <FontAwesomeIcon icon={faLinkedin} fixedWidth className={'text-xs'} />,
    },
]

The other instance I think there might be spacing issues is with plain text or emojis but I think it is up to the users to enforce proper spacing and sizing.

@timlrx
Copy link
Owner

timlrx commented Sep 20, 2023

Thanks for the explanation and LGTM!

@timlrx timlrx merged commit e16568b into timlrx:main Sep 20, 2023
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.

2 participants