This is a fork of the Animal Avatar Generator library, modified to work with Next.js
To make this library compatible with Next.js, the following changes were made:
- Updated the TypeScript configuration to output CommonJS modules instead of ESM.
- Provided instructions for users on how to adjust the import syntax for the avatar function in their Next.js components to work with this modified library.
In your Next.js project, install the package using npm or yarn:
npm install https://github.com/vlazic/nextjs-animal-avatar-generator --save
yarn add https://github.com/vlazic/nextjs-animal-avatar-generator
To use the generator in your Next.js components, you can require the library:
const avatar = require('nextjs-animal-avatar-generator').default;
Then, you can use the avatar
function to generate SVG avatars:
function Avatar(props) {
const svg = avatar(props.name, { size: 200 });
return (
<div width="200" height="200" dangerouslySetInnerHTML={{ __html: svg }} />
);
}
For the complete list of configuration options, please refer to the original Animal Avatar Generator library.
MIT