import type { Meta, StoryObj } from '@storybook/react'; import { useCellId } from './use-cell-id'; // Adjust path accordingly import type { SimpleElement } from '../../.storybook/decorators/with-simple-data'; import { HTMLNode, SimpleRenderItemDecorator } from '../../.storybook/decorators/with-simple-data'; import { makeRootDocumentation } from '@joint/react/src/stories/utils/make-story'; import { getAPILink } from '@joint/react/src/stories/utils/get-api-documentation-link'; import '../stories/examples/index.css'; function Hook(_: SimpleElement) { const cellId = useCellId(); // Using the hook inside a component return cellId is: {cellId}; } export type Story = StoryObj; const API_URL = getAPILink('useCellId'); const meta: Meta = { title: 'Hooks/useCellId', component: Hook, decorators: [SimpleRenderItemDecorator], parameters: makeRootDocumentation({ description: '`useCellId` is a hook that returns the cellId of the current cell. It is used to get the cellId of the current cell. It must be used inside `renderElement`', apiURL: API_URL, code: `import { useCellId } from '@joint/react' function Component() { const cellId = useCellId(); return
cellId is: {cellId}
; }`, }), }; export default meta; export const Default: Story = {};