resolvetosavelives / healthicons

A collection of open source icons for public health projects.
https://healthicons.org
MIT License
619 stars 48 forks source link

How do i import in my React Project #197

Closed izzabellerina closed 2 months ago

izzabellerina commented 3 months ago

So sorry that i can't find the way to import to the project. Can u explain how to import it from filename like blood_b_n to the react project.

Thank you in advance

nburka commented 2 months ago

@izzabellerina I will respond later today, or tomorrow with some sample code.

izzabellerina commented 2 months ago

@nburka Thank you in advance , and i found the solution but the problem is that I set the color = red and then the icon didn't change for me <BloodBag color="red" height={36} width={36} /> I found solution from this website https://www.npmjs.com/package/healthicons-react

Thank you again

nburka commented 2 months ago

Nice! I didn't even see your response here before I tried it myself. It is super easy. All I did was:

  1. create a sample React app using create-react-app
  2. add the NPM package for the icons using: npm i healthicons
  3. edited the App.js and added import { ReactComponent as HeartIcon} from 'healthicons/public/icons/svg/filled/body/heart_organ.svg'; and then used the icon by adding: <HeartIcon color="red" height={100} width={100} />

Glad it worked for you!!

nburka commented 2 months ago

It looked like this:

Screenshot 2024-04-04 at 4 52 37 PM

nburka commented 2 months ago

I'll close this issue. But let me know if you have any more questions.