storybook-addon-perfect-design

1.0.1 • Public • Published

Storybook Addon Perfect Design

This addon helps develop your components with pixel perfect accuracy! It allows you put a semi-transparent image overlay over the top of the developed component and perform pixel-to-pixel comparison between them.

Keyboard shortcuts

  • [Shift + Arrow keys] for 10px position change
  • [Alt + Shift + Arrow keys] for 0.1px position change

Getting Started

Requires Storybook 6.1 or later. Install the latest with npx sb upgrade --prerelease

First, install the addon

npm i -D storybook-addon-perfect-design

Then, add following content to .storybook/main.js:

module.exports = {
  addons: ['storybook-addon-perfect-design']
};

Usage

Within your stories:

import React from 'react';

import imageUrl from './images/my-image.jpg'; 

export default {
  title: 'Design Assets',
  parameters: {
    assets: [
      imageUrl, // link to a file imported
      'https://via.placeholder.com/300/09f/fff.png', // link to an external image
      'https://www.example.com', // link to a webpage
      'https://www.example.com?id={id}', // link to a webpage with the current story's id in the url
    ],
  },
};

export const defaultView = () => (
  <div>your story here</div>
);

Readme

Keywords

Package Sidebar

Install

npm i storybook-addon-perfect-design

Weekly Downloads

380

Version

1.0.1

License

MIT

Unpacked Size

25.1 kB

Total Files

11

Last publish

Collaborators

  • generalov