Skip to content

Commit

Permalink
docs(storybook): skip code snippet generation for components that hav…
Browse files Browse the repository at this point in the history
…e render functions
  • Loading branch information
mgadewoll committed May 24, 2024
1 parent a191b67 commit 6d3413d
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ const meta: Meta<EuiInMemoryTableProps> = {
title: 'Tabular Content/EuiInMemoryTable',
// @ts-ignore complex
component: EuiInMemoryTable,
parameters: {
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
args: {
allowNeutralSort: true,
searchFormat: 'eql',
Expand Down
6 changes: 6 additions & 0 deletions packages/eui/src/components/datagrid/data_grid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ const RenderCellValue = ({
const meta: Meta<EuiDataGridProps> = {
title: 'Tabular Content/EuiDataGrid',
component: EuiDataGrid,
parameters: {
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
argTypes: {
width: { control: 'text' },
height: { control: 'text' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const meta: Meta<DragDropContextProps> = {
// visual parts with the Drag and Drop components separately
skip: true,
},
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
};
enableFunctionToggleControls(meta, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export const Interactive: Story = {
'customDragHandle',
],
},
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
args: {
draggableId: 'draggable-item',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ const makeId = htmlIdGenerator();
const meta: Meta<EuiDroppableProps> = {
title: 'Display/EuiDroppable',
component: EuiDroppable,
parameters: {
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
argTypes: {
droppableId: {
type: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ import {
const meta: Meta<EuiMutationObserverProps> = {
title: 'Utilities/EuiMutationObserver',
component: EuiMutationObserver,
parameters: {
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
};

export default meta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ import { EuiResizeObserver, EuiResizeObserverProps } from './resize_observer';
const meta: Meta<EuiResizeObserverProps> = {
title: 'Utilities/EuiResizeObserver',
component: EuiResizeObserver,
parameters: {
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
};

export default meta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ const MultiCollapsible: EuiResizableContainerProps['children'] = (
const meta: Meta<EuiResizableContainerProps> = {
title: 'Layout/EuiResizableContainer/EuiResizableContainer',
component: EuiResizableContainer,
parameters: {
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
args: {
direction: 'horizontal',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ faker.seed(42);
const meta: Meta<EuiResizablePanelProps> = {
title: 'Layout/EuiResizableContainer/Subcomponents/EuiResizablePanel',
component: EuiResizablePanel,
parameters: {
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
argTypes: {
mode: {
control: 'radio',
Expand Down
12 changes: 11 additions & 1 deletion packages/eui/src/components/selectable/selectable.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ const options: EuiSelectableOption[] = [
const meta: Meta<EuiSelectableProps> = {
title: 'Forms/EuiSelectable',
component: EuiSelectable,
parameters: {
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
argTypes: {
singleSelection: { control: 'radio', options: [true, false, 'always'] },
emptyMessage: { control: 'text' },
Expand Down Expand Up @@ -111,7 +117,11 @@ export const WithTooltip: Story = {
},
},
args: {
options: options.map((option) => ({ ...option, ...toolTipProps })),
options: options.map((option, idx) => ({
...option,
...toolTipProps,
value: idx,
})),
searchable: false,
},
render: ({ ...args }: EuiSelectableProps) => <StatefulSelectable {...args} />,
Expand Down
10 changes: 10 additions & 0 deletions packages/eui/src/components/text_diff/text_diff.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@ import React, { ReactElement } from 'react';
import type { Meta, StoryObj } from '@storybook/react';

import { hideStorybookControls } from '../../../.storybook/utils';
import { STORY_ARGS_MARKER } from '../../../.storybook/addons/code-snippet/constants';
import { useEuiTextDiff, EuiTextDiffProps } from './text_diff';

const meta: Meta<EuiTextDiffProps> = {
title: 'Utilities/useEuiTextDiff',
// casting here to match story output while preserving component docgen information
component: useEuiTextDiff as unknown as () => ReactElement,
parameters: {
codeSnippet: {
// the story returns a component but the actual code is a hook pattern
// we can provide a manual snippet instead
snippet: `
const [rendered, textDiffObject] = useTextDiff(${STORY_ARGS_MARKER})
`,
},
},
argTypes: {
insertComponent: { control: 'text' },
deleteComponent: { control: 'text' },
Expand Down
4 changes: 4 additions & 0 deletions packages/eui/src/components/tour/tour.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const meta: Meta<EuiTourProps> = {
component: EuiTour,
parameters: {
layout: 'fullscreen',
codeSnippet: {
// TODO: enable once render functions are supported
skip: true,
},
},
decorators: [
(Story, { args }) => (
Expand Down

0 comments on commit 6d3413d

Please sign in to comment.