Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

airbnb/react-component-variations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

❗ Deprecation Notice
We want to express our sincere gratitude for your support and contributions to this open source project. As we are no longer using this technology internally, we have come to the decision to archive this repository. While we won't be providing further updates or support, the existing code and resources will remain accessible for your reference. We encourage anyone interested to fork the repository and continue the project's legacy independently. Thank you for being a part of this journey and for your patience and understanding.

react-component-variations

⚠️ Warning: this project is still very alpha

This project is:

  • A format called "variations" for specifying React component examples and providing documentation for them.
  • Tools for finding, validating, and iterating over variations.

A variation looks like:

// ButtonVariationProvider.jsx

import React from 'react';
import Button from '../components/Button';

export default function ButtonVariationProvider({ action }) {
  return {
    component: Button,

    usage: 'Buttons are things you click on!',

    variations: [
      {
        title: 'Default',
        render: () => <Button onClick={() => action('onClick')}>click me!</Button>,
      },
      {
        title: 'Disabled',
        render: () => <Button disabled>Nope</Button>
      }
    ],
  };
}

We also have "consumers" that use the variation provider to perform tasks. Example consumers are:

  • Rendering variations in Storybook
  • Running in tests with Enzyme
  • Taking screenshots with Happo
  • Checking for accessibility violations with Axe

Contribution Guidelines:

  1. Fork this Repo
  2. Install dependencies by running npm install in the root of the project directory.
  3. To run lint and test run locally, in the project root run npm test. To run tests only, npm run tests-only.

Make sure new helpers and traversal functions have related tests.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •