Skip to content

Storybook

About

Create a component

import { React } from "react";

Doing the Storybook Tutorial Tutorial

Notes

Updates

Setup

[remote "origin"]
    url = git@personal:catenare/TaskBox.git
    fetch = +refs/heads/*:refs/remotes/origin/*
git remote add learn https://github.com/chromaui/learnstorybook-code.git
git fetch learn
git restore -s learn/master -- src/index.css
git restore -s learn/master -- public/font
git restore -s learn/master -- public/icon
  • Update package.json to run storybook on a different port and without going to the browser.
"storybook": "start-storybook -p 9009 -s public --ci"

Tutorial

Simple Component

  • href attribute is required
{
  state !== "TASK_ARCHIVED" && (
    <a href="*" onClick={() => onPinTask(id)}>
      <span className={`icon-star`} />
    </a>
  );
}

Screens

  • InboxScreen.js - Import PureTaskList rather than TaskList
  • Update App.test.js to no longer look for the test link.
test("render taskbox screen", () => {
  const { getByText } = render(<App />);
  const linkElement = getByText(/Taskbox/i);
  expect(linkElement).toBeInTheDocument();
});

Testing using chromatic

  • Start chromatic without starting storybook - --do-not-start

Last update: April 13, 2020 18:45:56