0.0.21 • Published 9 months ago

@nexusmutual/logos v0.0.21

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
9 months ago

@nexusmutual/logos

Installation

npm i @nexusmutual/logos

Usage

It is possible to import the logos as React components. This way they end up in the bundle and do not need to be loaded after the page is rendered like with the <img> tag.

import { NexusMutual } from "@nexusmutual/logos";

export default async function Example() {
  return <NexusMutual className="w-12" />;
}

Another option is to use the SVG files directly from the public folder. This way they can be loaded after the page is rendered and the bundle size is not affected.

export default async function Example() {
  return (
    <Image
      src="logos/nexusmutual.svg"
      alt="nexusmutual logo"
      width={24}
      height={24}
    />
  );
}

Or import the SVG file directly from the public folder, this way it also ends up in the bundle.

import NexusMutual from "public/logos/nexus-mutual.svg";

// Or this:
// import NexusMutual from '@nexusmutual/logos/dist/img/nexus-mutual.svg';

export default async function Example() {
  return (
    <Image src={NexusMutual} alt="nexusmutual logo" width={24} height={24} />
  );
}

Utilities

Some extra stuff is exposed to make it easier to work with the logos.

Types

The LogoFileName type is an union of all the logo names based on the file names.

import { LogoFileName } from "@nexusmutual/logos";

const name: LogoFileName = "nexus-mutual";

All logo names

The allLogoFileNames variable contains all the logo names based on the file names.

import { allLogoFileNames } from "@nexusmutual/logos";

export default async function Example() {
  return (
    {allLogoFileNames.map((name: LogoFileName) => (
      <Image key={name} src={`logos/${name}.svg`} alt={name} width={24} height={24} />
    ))}
  );
}

Contributing

Adding a new logo

To add a new logo, add the SVG file to the src/ folder and add the filename to scripts/data/product-logo-filenames.js. Then run npm run build to see if it worked.

0.0.20

9 months ago

0.0.21

9 months ago

0.0.16

10 months ago

0.0.17

10 months ago

0.0.18

10 months ago

0.0.19

10 months ago

0.0.15

11 months ago

0.0.14

11 months ago

0.0.13

11 months ago

0.0.12

11 months ago

0.0.11

11 months ago

0.0.10

11 months ago