codex-team / task-manager

3 stars 2 forks source link

Refactor Icon component to use Sprite #107

Open iegik opened 2 years ago

iegik commented 2 years ago

Implements #63

This makes ability to add Icons by their use:link in the SVG sprite

Usage:

// Sprite.tsx

// eslint-disable-next-line import/no-webpack-loader-syntax
import HomeIcon from '!!raw-loader!icons/home.svg';
// eslint-disable-next-line import/no-webpack-loader-syntax
import DefaultAvatar from '!!raw-loader!icons/DefaultAvatar.svg';
// eslint-disable-next-line import/no-webpack-loader-syntax
import PlusIcon from '!!raw-loader!icons/plus.svg';

const icons = {
  'home': HomeIcon,
  'DefaultAvatar': DefaultAvatar,
  'plus': PlusIcon,
};
      /* somewhere in the app's page */
      <Icon name="home" />

      /* somewhere on App.tsx */
      <Sprite />
Screenshot 2022-02-04 at 18 23 05