How to use @talend/icons - 2 common examples

To help you get started, we’ve selected a few @talend/icons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Talend / ui / packages / components / src / IconsProvider / IconsProvider.component.js View on Github external
import PropTypes from 'prop-types';
import React from 'react';
import { filters } from '@talend/icons/dist/react';
import { getIconHref as getIcon } from '@talend/icons/dist/info';

let talendIcons = {};

if (!process.env.ICON_BUNDLE) {
	console.warn('WARNING ICON_BUNDLE will be the default in the next major release');
	talendIcons = require('@talend/icons/dist/react').default;
}

const context = {
	ids: [],
	// default no op for testing (case of Icon call without IconsProvider)
	get: () => {},
};

export function getIconHREF(name) {
	if (context.ids.indexOf(name) !== -1) {
		return `#${name}`;
	}
	let href = context.get(name);
	if (!href) {
		if (process.env.ICON_BUNDLE) {
			href = getIcon(name);
github Talend / ui / packages / components / src / IconsProvider / IconsProvider.component.js View on Github external
export function getIconHREF(name) {
	if (context.ids.indexOf(name) !== -1) {
		return `#${name}`;
	}
	let href = context.get(name);
	if (!href) {
		if (process.env.ICON_BUNDLE) {
			href = getIcon(name);
		} else {
			// backward compatibility for test
			href = `#${name}`;
		}
	}
	return href;
}

@talend/icons

A scalable set of icons handcrafted with <3 by Talend.

Apache-2.0
Latest version published 2 months ago

Package Health Score

81 / 100
Full package analysis