GithubHelp home page GithubHelp logo

dimitrisraptis96 / react-eva-icons Goto Github PK

View Code? Open in Web Editor NEW
14.0 1.0 6.0 3.72 MB

⚛:heart: ReactJS component for open source Eva Icons library

Home Page: https://dimitrisraptis96.github.io/react-eva-icons/

License: MIT License

JavaScript 96.03% CSS 3.97%
react eva eva-icons icons icon-pack

react-eva-icons's Introduction

⚛:heart: react-eva-icons

Build Status

React.js components for the awesome open source Eva Icons library.

Demo

Visit here

 

Getting Started

Using npm

 npm install --save react-eva-icons

Or using yarn

 yarn add react-eva-icons

 

Usage

import Icon from 'react-eva-icons';

...

render (
  <Icon 
    name="activity"
    size="medium"     // small, medium, large, xlarge
    animation={{
      type: "pulse",  // zoom, pulse, shake, flip
      hover: true,
      infinite: false 
    }}
  />
);

 

Props

Option Type Values Description
animation object See here Icon animation
fill string e.g. '#fff' Icon color
name string e.g. 'activity' Define the name of the icon
size string small, medium, large, ``xlarge Icon size

 

Known Issues

When using Gatsby and server-side rendering, you should dynamic import the library:

let Icon
if (typeof window !== "undefined") {
  import("react-eva-icons").then(module => Icon = module.default);
}

Issue and solution by @taniotanio7 here

 

License

MIT

 

Made with 🤘 by @d__raptis

react-eva-icons's People

Contributors

dimitrisraptis96 avatar r-yoshi0701 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-eva-icons's Issues

removeChild error when trying to unmount Icon component

I get this error when trying to remove the Icon component from the DOM:

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
    at removeChild (http://localhost:3000/static/js/1.chunk.js:87249:22)
...

I'm using the loading icon and want to show it only when I'm submitting a form.
I used it like this:

<Button
	className="medium w-100"
	type="submit"
	disabled={isSubmitting}
>
	{isSubmitting && (
	<Icon
		name="loader-outline"
		size="medium"
		animation={{ type: 'pulse', infinite: true, hover: false }}
	/>
	)}
	{!isSubmitting ? (signup ? 'Create Account' : 'Sign In') : ''}
</Button>

Cannot create React Component

Right now when React Component is created as a wrapper for eva icon, it produces the following message: 'TypeError: Cannot read property 'toSvg' of undefined'.

Does anyone have idea why does this happen?

Icons break server-side rendering (window is not defined)

When using Gatsby along with react-eva-icons the server-side rendering is broken when using regular import:

import Icon from "react-eva-icons"

with error: " WebpackError: ReferenceError: window is not defined"

According to the error message the issue occurs in node_modules/eva-icons/eva.js:354:1
in the isOldIE function that is part of the eva-icon dependency. I've checked the source for eva-icons and didn't found any isOldIE function, so I assume that it is added by Webpack?

Anyway... I've fixed the issue with dynamic ES6 import:

let Icon
if (typeof window !== "undefined") {
  import("react-eva-icons").then(module => Icon = module.default);
}

I suppose it might be a good idea to add note about this in the Readme or perhaps find a better solution to this issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.