react-awesome-gravatar
Installation
npm install react-awesome-gravatar --saveyarn add react-awesome-gravatar
Usage
Gravatar component
; Gravatar email= /Gravatar// Should generate an <img /> tag with the correct gravatar profile url: https://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8;; // check below for all available optionsGravatar email="example@example.com" options= /Gravatar// Should generate an <img /> tag with the correct gravatar profile url: https://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8?size=50
Just the function
If you just need the URL to the profile image of gravatar, you can omit the use of the component and call the function that the component calls directly.
; ;// profileUrl has the profile url: https://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8 ;; // check below for all available options ;// profileUrl has the profile url: https://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8?size=50
Options
The options match 1:1 to the Gravatar API except for defaultUrl
which if present set the Gravatar default
to it.
;// profileUrl has the profile url: https://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8?default=http://example.com/image.png
Tests
Tests are configured with Jest, to run them use:
npm run test