Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brandonbryant12/52d455b6427fca0fbff8deaec1848dd9 to your computer and use it in GitHub Desktop.
Save brandonbryant12/52d455b6427fca0fbff8deaec1848dd9 to your computer and use it in GitHub Desktop.
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import EntityCustomInfoCard from './EntityCustomInfoCard';
export default {
title: 'Components/EntityCustomInfoCard',
component: EntityCustomInfoCard,
// Set up default inline mocks for the hooks used in EntityCustomInfoCard.
// Adjust the module paths (e.g. 'src/hooks/useEntity') to match your project structure.
parameters: {
moduleMock: {
'src/hooks/useEntity': {
useEntity: () => ({
id: 'entity-1',
name: 'Test Entity',
// ...add any other properties your component needs
}),
},
'src/hooks/useClientAccessCheck': {
useClientAccessCheck: () => true,
},
},
},
} as Meta<typeof EntityCustomInfoCard>;
type Story = StoryObj<typeof EntityCustomInfoCard>;
// Story where the client has access
export const WithAccess: Story = {
render: (args) => <EntityCustomInfoCard {...args} />,
};
// Story where the client does not have access
export const WithoutAccess: Story = {
parameters: {
moduleMock: {
'src/hooks/useEntity': {
useEntity: () => ({
id: 'entity-1',
name: 'Test Entity',
// ...other properties as needed
}),
},
'src/hooks/useClientAccessCheck': {
useClientAccessCheck: () => false,
},
},
},
render: (args) => <EntityCustomInfoCard {...args} />,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment