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

Icon identifier #25

Open
photodow opened this issue Oct 1, 2020 · 1 comment
Open

Icon identifier #25

photodow opened this issue Oct 1, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@photodow
Copy link
Contributor

photodow commented Oct 1, 2020

Can we build a feature into the specs section, that will look at icons and determine whether it's custom or part of the IDL/Carbon icon library? Maybe there is some sort of check to make sure it's the right size for the font size?

@photodow photodow added the enhancement New feature or request label Oct 1, 2020
@photodow
Copy link
Contributor Author

In addition, maybe a component list would be worthwhile too... Here is a potential way to identify the icons in the wild.

function findPictogram (pictogramName) {
  return [...document.querySelectorAll('svg')].filter(pictogram => {
        const title = pictogram.querySelector('title');

        return title && title.textContent.toLowerCase() === pictogramName.toLowerCase();
    });
}

A much heavier option might be to render each icon to html, and use regex to search the a string of the DOM like document.body.innerHTML.

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

No branches or pull requests

1 participant