Skip to content

vlazic/nextjs-animal-avatar-generator

 
 

Repository files navigation

NextJS Animal Avatar Generator

This is a fork of the Animal Avatar Generator library, modified to work with Next.js

Modifications for Next.js Compatibility

To make this library compatible with Next.js, the following changes were made:

  1. Updated the TypeScript configuration to output CommonJS modules instead of ESM.
  2. 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.

Usage in Next.js

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.

License

MIT

Packages

No packages published

Languages

  • TypeScript 94.8%
  • JavaScript 4.6%
  • HTML 0.6%