Skip to content

docs: fix Dialog stories and usage table width #4546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .storybook/components/Import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const ImportStatement = ({ moduleName, packageName }: ImportStatementProp
return (
<pre
style={{
display: 'block',
display: 'contents',
overflowX: 'auto',
padding: '0px',
background: 'white',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ValueState } from '../../enums/ValueState.js';
import { Bar } from '../../webComponents/Bar/index.js';
import { Button } from '../../webComponents/Button/index.js';
// todo replace once `createPortal` is supported
import { Dialog } from '../../webComponents/Dialog/Dialog.stories.js';
import { Dialog } from '../../webComponents/Dialog/CodeGen.js';
import { Link } from '../../webComponents/Link/index.js';
// todo replace once `createPortal` is supported
import { ResponsivePopover } from '../../webComponents/ResponsivePopover/CodeGen.js';
Expand Down
10 changes: 10 additions & 0 deletions packages/main/src/webComponents/Dialog/CodeGen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React, { forwardRef } from 'react';
import { createPortal } from 'react-dom';
import { Dialog as OriginalDialog, DialogDomRef, DialogPropTypes } from './index';

// todo remove once portals are supported inline, or general popovers are supported w/o having to mount them to the body
export const Dialog = forwardRef<DialogDomRef, DialogPropTypes>((args, ref) =>
createPortal(<OriginalDialog {...args} ref={ref} />, document.body)
);

Dialog.displayName = 'Dialog';
13 changes: 3 additions & 10 deletions packages/main/src/webComponents/Dialog/Dialog.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { isChromatic } from '@sb/utils';
import type { Meta, StoryObj } from '@storybook/react';
import settingsIcon from '@ui5/webcomponents-icons/dist/settings.js';
import React, { forwardRef, useEffect, useState } from 'react';
import { createPortal } from 'react-dom';
import React, { useEffect, useState } from 'react';
import { BarDesign } from '../../enums';
import { Bar, Button, DialogDomRef, DialogPropTypes, Icon, List, StandardListItem, Title } from '../index.js';
import { Bar, Button, Icon, List, StandardListItem, Title } from '../index.js';
import { Dialog } from './CodeGen';
import { Dialog as OriginalDialog } from './index';

const meta = {
Expand All @@ -21,13 +21,6 @@ const meta = {
}
} satisfies Meta<typeof OriginalDialog>;

// todo remove once portals are supported inline, or general popovers are supported w/o having to mount them to the body
export const Dialog = forwardRef<DialogDomRef, DialogPropTypes>((args, ref) =>
createPortal(<OriginalDialog {...args} ref={ref} />, document.body)
);

Dialog.displayName = 'Dialog';

export default meta;
type Story = StoryObj<typeof meta>;

Expand Down