storybook-addon-next-auth0
Advanced tools
Weekly downloads
Readme
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.
npm i -d storybook-addon-next-auth0
add "storybook-addon-next-auth0" to you .storybook/main.js
addons
That's all.
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",
],
}
You can pass the initial useUser value to any story though story's parameters
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'
}
}
FAQs
Managed userProvider decorator for nextjs-auth0
The npm package storybook-addon-next-auth0 receives a total of 1,104 weekly downloads. As such, storybook-addon-next-auth0 popularity was classified as popular.
We found that storybook-addon-next-auth0 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.