Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
renderIconName() {
let props = this.props;
let app = props.app,
options = app.options,
iconName = props.iconName,
showPrefix =
!props.view ||
props.view.type !== 'collection' ||
props.view.prefix !== options.icon.prefix,
text = showPrefix ? iconName : options.icon.name,
data = Iconify.getIcon(iconName),
sampleHeight = props.container.scaleDownIcon(data.height), // ignore other attributes because rotation is not applied
sample = FullFooter.renderSample(iconName, {});
return (
);
}
.replace('{prefix}', icon.prefix)
.replace('{name}', icon.name);
if (!loaded) {
return (
);
}
let iconData = Iconify.getIcon(name);
let tooltip = [
lang.name.replace('{name}', props.title),
lang.size
.replace('{width}', iconData.width)
.replace('{height}', iconData.height),
lang.palette.replace(
'{palette}',
iconData.body.indexOf('currentColor') === -1
? lang.colors
: lang.colorless
),
];
tooltip = tooltip.join('\n');
// Generate SVG
if (!loaded) {
return (
{deleteButton}
);
}
let icon = props.icon,
iconData = Iconify.getIcon(name);
// Generate link and tooltip
let link = props.config.links.icon
.replace('{prefix}', icon.prefix)
.replace('{name}', icon.name);
let tooltip = [
lang.name.replace('{prefix}', icon.prefix).replace('{name}', icon.name),
lang.size
.replace('{width}', iconData.width)
.replace('{height}', iconData.height),
lang.palette.replace(
'{palette}',
iconData.body.indexOf('currentColor') === -1
? lang.colors
: lang.colorless
if (event && event.preventDefault) {
event.preventDefault();
}
// Get selected icon
if (options && options.iconName !== void 0) {
iconName = options.iconName;
delete options.iconName;
}
if (iconName === null) {
return;
}
// Get icon data
let iconData = Iconify.getIcon(iconName);
if (!iconData) {
return;
}
// Add icon to recent list
let ui = this.props.ui;
ui.storeIcon('recent', iconName);
if (
this.route.page === 'recent' &&
this.iconifyView &&
this.iconifyView.sync
) {
this.iconifyView.sync();
}
render() {
let props = this.props,
container = props.container;
let app = props.app,
iconName = props.iconName,
data = Iconify.getIcon(iconName),
options = app.options,
transformations = options.getIconTransformations(true),
sample = FullFooter.renderSample(iconName, transformations),
sampleHeight = container.scaleDownIcon(
data.height,
data.width,
transformations.rotate
),
sampleLimit = 128,
hasColor = sample.indexOf('currentColor') !== -1;
// Change color in sample
if (hasColor && transformations.color !== '') {
sample = sample.replace(/currentColor/g, transformations.color);
}