Created
March 7, 2025 16:42
-
-
Save brandonbryant12/52d455b6427fca0fbff8deaec1848dd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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