Skip to content

Instantly share code, notes, and snippets.

@mateusz-wierzbicki
Created May 22, 2024 09:21
Show Gist options
  • Save mateusz-wierzbicki/81cfc74c178baba1b7439b1cf6b5084a to your computer and use it in GitHub Desktop.
Save mateusz-wierzbicki/81cfc74c178baba1b7439b1cf6b5084a to your computer and use it in GitHub Desktop.
import React from 'react';
import * as TablerIcons from '@tabler/icons-react';
// Default size and stroke width for all icons
const defaultSize = '1em';
const defaultStrokeWidth = 2;
const getIcon = (IconComponent) => {
return (
<IconComponent
className="anticon"
size={defaultSize}
strokeWidth={defaultStrokeWidth}
/>
);
};
// Create the icon map
const IconMap = {};
Object.keys(TablerIcons).forEach((iconName) => {
IconMap[iconName] = getIcon(TablerIcons[iconName]);
});
export default IconMap;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment