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

[Icons] Export icon constants #4877

Closed
sorenlouv opened this issue Jun 14, 2021 · 2 comments
Closed

[Icons] Export icon constants #4877

sorenlouv opened this issue Jun 14, 2021 · 2 comments

Comments

@sorenlouv
Copy link
Member

sorenlouv commented Jun 14, 2021

Currently to use a (third party) icon it is only possible to use a string as the logo identifier:

<EuiIcon type='logoAWS' />

This is error prone since the there's nothing preventing the dev making a spelling mistakes, or renaming an icon on the EUI side without updating the consumers.
To prevent these mistakes, catch changes and improve intellisense I suggest icons are consumed as constants:

<EuiIcon type={euiIcons.logoAws} />

Afaict all that's needed is to export typeToPathMap:

const typeToPathMap = {
accessibility: 'accessibility',
addDataApp: 'app_add_data',
advancedSettingsApp: 'app_advanced_settings',
aggregate: 'aggregate',
alert: 'alert',
analyzeEvent: 'analyze_event',
annotation: 'annotation',
apmApp: 'app_apm',
apmTrace: 'apm_trace',
apps: 'apps',
appSearchApp: 'app_app_search',
arrowDown: 'arrow_down',
arrowLeft: 'arrow_left',
arrowRight: 'arrow_right',
arrowUp: 'arrow_up',
asterisk: 'asterisk',
auditbeatApp: 'app_auditbeat',

@github-actions
Copy link

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

@github-actions
Copy link

❌ We're automatically closing this issue due to lack of activity. Please comment if you feel this was done in error.

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

No branches or pull requests

2 participants