Skip to content

Bleeding-edge frontend template featuring twin.macro, Next.js, TypeScript and Storybook.

License

Notifications You must be signed in to change notification settings

freddydumont/twin-macro-next-boilerplate

Repository files navigation

twin-macro-next-boilerplate

Bleeding-edge frontend template featuring:

  • TypeScript
  • Next.js
  • twin.macro
  • Storybook (with interaction testing and test runner)
  • Cypress

This template relies on Storybook for both building and testing components.

Component generator

This template includes a component generator to avoid boilerplate and to standardize the folder structure.

yarn g MyComponent

Run yarn g --help for more info.

Testing

Storybook interaction testing

Write React Testing Library tests directly in Storybook using the play function:

LoggedIn.play = async ({ canvasElement }) => {
  const canvas = within(canvasElement);

  const loginButton = await canvas.getByRole('button', { name: /Log in/i });
  await userEvent.click(loginButton);

  const welcome = await canvas.findByText(/welcome/i);
  await expect(welcome).toBeInTheDocument();
};

See Page.stories.tsx.

Run your tests:

yarn storybook:test

Learn more about testing with Storybook:

twin.macro template documentation

Download this example using degit:

npx degit https://github.com/ben-rogerson/twin.examples/next-emotion-typescript folder-name

Installation instructions coming soon...

Customization

Next steps

Learn how to work with twin

Learn more about emotion

About

Bleeding-edge frontend template featuring twin.macro, Next.js, TypeScript and Storybook.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published