Big news!Introducing Socket AI - ChatGPT-Powered Threat Analysis. Learn more
Socket
Log inDemoInstall

storybook-addon-next-auth0

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Issues
File Explorer

Advanced tools

storybook-addon-next-auth0

Managed userProvider decorator for nextjs-auth0

    1.0.6latest
    GitHub

Version published
Maintainers
1
Weekly downloads
1,174
decreased by-7.49%

Weekly downloads

Readme

Source

storybook-addon-next-auth0

Allows you to use useUser from @auth0/nextjs-auth0

It decores your stories with a mocked UserProvider that you can control on a storybook panel.

screencap

Install

npm i -d storybook-addon-next-auth0

configuration

add "storybook-addon-next-auth0" to you .storybook/main.js addons

That's all.

example

module.exports = { const path = require("path"); module.exports = { "stories": [ "../components/**/*.stories.@(js|jsx)", "../pageStories/**/*.stories.@(js|jsx)", ], "addons": [ 'storybook-addon-next-auth0', "@storybook/addon-links", "@storybook/addon-essentials", ], }

Stories

You can pass the initial useUser value to any story though story's parameters

example

stories/Example.stories.js

import React from "react"; import { UserPrint } from "./Example"; export default { title: "Example/User", component: UserPrint, parameters: { initialUser: { isLoading: true, } } }; export const Loading = () => <UserPrint /> export const Logged = () => <UserPrint /> Logged.parameters = { initialUser: { isLoading: false, user: { email: 'john@doe.com', email_verified: true, nickname: 'Joe', picture: 'https://picsum.photos/200', sub: 'mock:johndoe', updated_at: '2021-04-02T12:42:42.042Z', } } } export const ErrorStory = () => <UserPrint /> ErrorStory.parameters = { initialUser: { isLoading: false, error: 'Something went wrong' } }

Keywords

FAQs

Last updated on 08 Aug 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc