JSPM

next-image-themed

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q22434F
  • License ISC

A Next.js Image Component that allows you to shows a different image in light and dark-mode, based on the users preference.

Package Exports

  • next-image-themed
  • next-image-themed/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (next-image-themed) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Next-Image-Themed

A Next.js Image Component that allows you to shows a different image in light and dark-mode, based on the users preference.

Installation

Using Yarn:

yarn add next-image-themed

Using NPM:

npm install next-image-themed

Usage

import ThemedImage from "next-image-themed";

import LightModeImage from "assets/images/light-mode.png";
import DarkModeImage from "assets/images/dark-mode.png";

const MyComponent = () => (
  <ThemedImage
    // The image to show in light-mode.
    light={LightModeImage}
    // The image to show in dark-mode.
    dark={DarkModeImage}
    // Pass the rest of the props to the Image component as you normally would.
    alt='My Image'
    loading='lazy'
  />
);