Skip to content

Commit 3ec5115

Browse files
authoredFeb 14, 2024··
docs: remove unnecessary CodeGen files (#5497)
1 parent c9197ca commit 3ec5115

29 files changed

+124
-165
lines changed
 

‎.eslintignore

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ packages/cypress-commands/dist
2121

2222
scripts
2323
shared
24-
CodeGen.tsx
2524
examples
2625
templates
2726

‎packages/main/src/components/DynamicPage/CodeGen.tsx

-3
This file was deleted.

‎packages/main/src/components/DynamicPage/DynamicPage.stories.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
VariantItem,
3434
VariantManagement
3535
} from '../..';
36-
import { SpacingSpan } from './CodeGen';
3736
import { DynamicPage } from './index.js';
3837

3938
const meta = {
@@ -106,7 +105,7 @@ const meta = {
106105
<Label>Halway: 23L</Label>
107106
<Label>Rack: 34</Label>
108107
</FlexBox>
109-
{SpacingSpan}
108+
<span style={{ width: '1rem' }} />
110109
<FlexBox direction={FlexBoxDirection.Column}>
111110
<Label>Availability:</Label>
112111
<ObjectStatus state={ValueState.Success}>In Stock</ObjectStatus>

‎packages/main/src/components/MessageBox/CodeGen.tsx

-11
This file was deleted.

‎packages/main/src/components/MessageBox/MessageBox.stories.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
import { isChromatic } from '@sb/utils';
22
import type { Meta, StoryObj } from '@storybook/react';
3-
import { useEffect, useState } from 'react';
3+
import { forwardRef, useEffect, useState } from 'react';
4+
import { createPortal } from 'react-dom';
45
import { MessageBoxActions } from '../../enums/MessageBoxActions';
56
import { MessageBoxTypes } from '../../enums/MessageBoxTypes';
7+
import type { DialogDomRef } from '../../webComponents';
68
import { Button } from '../../webComponents/Button/index';
7-
import { MessageBox } from './CodeGen';
9+
import type { MessageBoxPropTypes } from './index.js';
810
import { MessageBox as OriginalMessageBox } from './index.js';
911

12+
// todo remove once portals are supported inline, or popovers are supported w/o having to mount them to the body
13+
const MessageBox = forwardRef<DialogDomRef, MessageBoxPropTypes>((args, ref) =>
14+
createPortal(<OriginalMessageBox {...args} ref={ref} />, document.body)
15+
);
16+
MessageBox.displayName = 'MessageBox';
17+
1018
const meta = {
1119
title: 'Modals & Popovers / MessageBox',
1220
component: OriginalMessageBox,

‎packages/main/src/components/MessageView/MessageView.stories.tsx

+22-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
11
import { generateMessageItems } from '@sb/mockData/generateMessageItems';
22
import type { Meta, StoryObj } from '@storybook/react';
33
import arrowLeftIcon from '@ui5/webcomponents-icons/dist/slim-arrow-left.js';
4-
import { useRef, useState } from 'react';
4+
import { forwardRef, useRef, useState } from 'react';
5+
import { createPortal } from 'react-dom';
56
import { ButtonDesign, FlexBoxAlignItems, FlexBoxJustifyContent, TitleLevel, ValueState } from '../../enums/index.js';
7+
import type {
8+
DialogDomRef,
9+
DialogPropTypes,
10+
ResponsivePopoverDomRef,
11+
ResponsivePopoverPropTypes
12+
} from '../../webComponents';
613
import { Bar } from '../../webComponents/Bar/index.js';
714
import { Button } from '../../webComponents/Button/index.js';
8-
// todo replace once `createPortal` is supported
9-
import { Dialog } from '../../webComponents/Dialog/CodeGen.js';
15+
import { Dialog as OriginalDialog } from '../../webComponents/Dialog';
1016
import { Link } from '../../webComponents/Link/index.js';
11-
// todo replace once `createPortal` is supported
12-
import { ResponsivePopover } from '../../webComponents/ResponsivePopover/CodeGen.js';
17+
import { ResponsivePopover as OriginalResponsivePopover } from '../../webComponents/ResponsivePopover';
1318
import { Title } from '../../webComponents/Title/index.js';
1419
import { FlexBox } from '../FlexBox/index.js';
1520
import { MessageViewButton } from '../MessageViewButton/index.js';
1621
import { MessageItem } from './MessageItem.js';
1722
import { MessageView } from './index.js';
1823

24+
// todo remove once portals are supported inline, or popovers are supported w/o having to mount them to the body
25+
const Dialog = forwardRef<DialogDomRef, DialogPropTypes>((args, ref) =>
26+
createPortal(<OriginalDialog {...args} ref={ref} />, document.body)
27+
);
28+
Dialog.displayName = 'Dialog';
29+
30+
// todo remove once portals are supported inline, or popovers are supported w/o having to mount them to the body
31+
const ResponsivePopover = forwardRef<ResponsivePopoverDomRef, ResponsivePopoverPropTypes>((args, ref) =>
32+
createPortal(<OriginalResponsivePopover {...args} ref={ref} />, document.body)
33+
);
34+
ResponsivePopover.displayName = 'ResponsivePopover';
35+
1936
const meta = {
2037
title: 'User Feedback / MessageView',
2138
component: MessageView,

‎packages/main/src/webComponents/AvatarGroup/AvatarGroup.stories.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import { AvatarGroupType } from '../../enums/AvatarGroupType';
33
import { Avatar } from '../Avatar/index.js';
4-
import { Avatar1, Avatar2 } from './CodeGen.js';
54
import { AvatarGroup } from './index.js';
65

76
const meta = {
@@ -26,8 +25,12 @@ export const Default: Story = {
2625
<AvatarGroup {...args}>
2726
<Avatar icon="employee" />
2827
<Avatar initials="JD" />
29-
<Avatar>{Avatar1}</Avatar>
30-
<Avatar>{Avatar2}</Avatar>
28+
<Avatar>
29+
<img src="https://sap.github.io/ui5-webcomponents/assets/images/avatars/woman_avatar_5.png" alt="Avatar1" />
30+
</Avatar>
31+
<Avatar>
32+
<img src="https://sap.github.io/ui5-webcomponents/assets/images/avatars/man_avatar_3.png" alt="Avatar2" />
33+
</Avatar>
3134
</AvatarGroup>
3235
);
3336
}

‎packages/main/src/webComponents/AvatarGroup/CodeGen.tsx

-8
This file was deleted.

‎packages/main/src/webComponents/Bar/Bar.stories.tsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { Button } from '../Button';
77
import { Input } from '../Input';
88
import { Link } from '../Link';
99
import { Title } from '../Title';
10-
import { CenterContent, EndContent, Img, StartContent } from './CodeGen';
1110
import { Bar } from './index.js';
1211

1312
const meta = {
@@ -20,9 +19,9 @@ const meta = {
2019
},
2120
args: {
2221
design: BarDesign.Header,
23-
startContent: StartContent,
24-
children: CenterContent,
25-
endContent: EndContent
22+
startContent: <span>Start Content</span>,
23+
children: <span>Center Content</span>,
24+
endContent: <span>End Content</span>
2625
},
2726
tags: ['package:@ui5/webcomponents-fiori']
2827
} satisfies Meta<typeof Bar>;
@@ -40,7 +39,11 @@ export const WithCustomElements: Story = {
4039
startContent={
4140
<>
4241
<Button icon={navBackIcon} design={ButtonDesign.Transparent} />
43-
{Img}
42+
<img
43+
src="https://raw.githubusercontent.com/SAP/ui5-webcomponents-react/main/assets/Logo.png"
44+
alt="logo"
45+
style={{ marginLeft: '6px', width: '120px' }}
46+
/>
4447
</>
4548
}
4649
endContent={

‎packages/main/src/webComponents/Bar/CodeGen.tsx

-12
This file was deleted.

‎packages/main/src/webComponents/Carousel/Carousel.stories.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import { CarouselArrowsPlacement } from '../../enums/CarouselArrowsPlacement';
3-
import { Img1, Img2, Img3 } from './CodeGen';
43
import { Carousel } from './index';
54

65
const meta = {
@@ -21,9 +20,9 @@ export const Default: Story = {
2120
render(args) {
2221
return (
2322
<Carousel {...args}>
24-
{Img1}
25-
{Img2}
26-
{Img3}
23+
<img src="https://sap.github.io/ui5-webcomponents/assets/images/sample1.jpg" alt="img-sample 1" />
24+
<img src="https://sap.github.io/ui5-webcomponents/assets/images/sample2.jpg" alt="img-sample 2" />
25+
<img src="https://sap.github.io/ui5-webcomponents/assets/images/sample3.jpg" alt="img-sample 3" />
2726
</Carousel>
2827
);
2928
}

‎packages/main/src/webComponents/Carousel/CodeGen.tsx

-5
This file was deleted.

‎packages/main/src/webComponents/Dialog/CodeGen.tsx

-10
This file was deleted.

‎packages/main/src/webComponents/Dialog/Dialog.stories.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@ import { isChromatic } from '@sb/utils';
22
import type { Meta, StoryObj } from '@storybook/react';
33
import settingsIcon from '@ui5/webcomponents-icons/dist/settings.js';
44
import { clsx } from 'clsx';
5-
import React, { useEffect, useState } from 'react';
5+
import { forwardRef, useEffect, useState } from 'react';
6+
import { createPortal } from 'react-dom';
67
import { BarDesign } from '../../enums';
8+
import type { DialogDomRef, DialogPropTypes } from '../index.js';
79
import { Bar, Button, Icon, List, StandardListItem, Title } from '../index.js';
8-
import { Dialog } from './CodeGen';
910
import { Dialog as OriginalDialog } from './index';
1011

12+
// todo remove once portals are supported inline, or popovers are supported w/o having to mount them to the body
13+
const Dialog = forwardRef<DialogDomRef, DialogPropTypes>((args, ref) =>
14+
createPortal(<OriginalDialog {...args} ref={ref} />, document.body)
15+
);
16+
Dialog.displayName = 'Dialog';
17+
1118
const meta = {
1219
title: 'Modals & Popovers / Dialog',
1320
component: OriginalDialog,

‎packages/main/src/webComponents/DynamicSideContent/CodeGen.tsx

-28
This file was deleted.

‎packages/main/src/webComponents/DynamicSideContent/DynamicSideContent.stories.tsx

+26-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { Meta, StoryObj } from '@storybook/react';
22
import { SideContentFallDown } from '../../enums/SideContentFallDown';
33
import { SideContentPosition } from '../../enums/SideContentPosition';
44
import { SideContentVisibility } from '../../enums/SideContentVisibility';
5-
import { MainContent, SideContent } from './CodeGen';
65
import { DynamicSideContent } from './index.js';
76

87
const meta = {
@@ -26,8 +25,32 @@ type Story = StoryObj<typeof meta>;
2625
export const Default: Story = {
2726
render(args) {
2827
return (
29-
<DynamicSideContent {...args} sideContent={SideContent}>
30-
{MainContent}
28+
<DynamicSideContent
29+
{...args}
30+
sideContent={
31+
<>
32+
<h1>Side Content</h1>
33+
<p>
34+
Morbi lorem libero, imperdiet id condimentum ac, tempor ut velit. Integer a laoreet sem. Nunc at sagittis
35+
nisi. Sed placerat diam eu porttitor dignissim. Maecenas nec fringilla tortor. Pellentesque ut elit est.
36+
Curabitur quis elit at mauris ullamcorper fringilla. Nullam diam mi, porttitor dictum orci nec, molestie
37+
luctus metus. Nunc ut ex blandit, elementum erat eget, pulvinar sapien. Donec nec lorem eu nunc eleifend
38+
tempor at non tortor. In quam velit, ornare at rutrum ac, porta ac augue. Suspendisse venenatis semper
39+
lacus at venenatis. Praesent vestibulum ligula nulla, at tempus lorem consequat suscipit. Aenean consequat
40+
dapibus dui, at bibendum mauris porta a.
41+
</p>
42+
</>
43+
}
44+
>
45+
<h1>Main Content</h1>
46+
<p>
47+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex mi, elementum et ante commodo, semper
48+
sollicitudin magna. Sed dapibus ut tortor quis varius. Sed luctus sem at nunc porta vulputate. Suspendisse
49+
lobortis arcu est, quis ultrices ipsum fermentum a. Vestibulum a ipsum placerat ligula gravida fringilla at id
50+
ex. Etiam pellentesque lorem sed sagittis aliquam. Quisque semper orci risus, vel efficitur dui euismod
51+
aliquet. Morbi sapien sapien, rhoncus et rutrum nec, rhoncus id nisl. Cras non tincidunt enim, id eleifend
52+
neque.
53+
</p>
3154
</DynamicSideContent>
3255
);
3356
}

‎packages/main/src/webComponents/Popover/CodeGen.tsx

-9
This file was deleted.

‎packages/main/src/webComponents/Popover/Popover.stories.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import '@ui5/webcomponents-icons/dist/settings.js';
22
import { isChromatic } from '@sb/utils';
33
import type { Meta, StoryObj } from '@storybook/react';
44
import { clsx } from 'clsx';
5-
import { useState } from 'react';
5+
import { forwardRef, useState } from 'react';
6+
import { createPortal } from 'react-dom';
67
import { BarDesign } from '../../enums/BarDesign';
78
import { PopoverHorizontalAlign } from '../../enums/PopoverHorizontalAlign';
89
import { PopoverPlacementType } from '../../enums/PopoverPlacementType';
@@ -14,9 +15,14 @@ import { Label } from '../Label';
1415
import { List } from '../List';
1516
import { StandardListItem } from '../StandardListItem';
1617
import { Title } from '../Title';
17-
import { Popover } from './CodeGen';
18+
import type { PopoverDomRef, PopoverPropTypes } from './index';
1819
import { Popover as OriginalPopover } from './index';
1920

21+
const Popover = forwardRef<PopoverDomRef, PopoverPropTypes>((args, ref) =>
22+
createPortal(<OriginalPopover {...args} ref={ref} />, document.body)
23+
);
24+
Popover.displayName = 'Popover';
25+
2026
const meta = {
2127
title: 'Modals & Popovers / Popover',
2228
component: OriginalPopover,

‎packages/main/src/webComponents/ResponsivePopover/CodeGen.tsx

-13
This file was deleted.

‎packages/main/src/webComponents/ResponsivePopover/ResponsivePopover.stories.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { isChromatic } from '@sb/utils';
22
import type { Meta, StoryObj } from '@storybook/react';
33
import { clsx } from 'clsx';
4-
import { useState } from 'react';
4+
import { forwardRef, useState } from 'react';
5+
import { createPortal } from 'react-dom';
56
import { PopoverHorizontalAlign } from '../../enums/PopoverHorizontalAlign';
67
import { PopoverPlacementType } from '../../enums/PopoverPlacementType';
78
import { PopoverVerticalAlign } from '../../enums/PopoverVerticalAlign';
@@ -12,10 +13,16 @@ import { Label } from '../Label';
1213
import { List } from '../List';
1314
import { StandardListItem } from '../StandardListItem';
1415
import { Title } from '../Title';
15-
import { ResponsivePopover } from './CodeGen.js';
16+
import type { ResponsivePopoverDomRef, ResponsivePopoverPropTypes } from './index';
1617
import { ResponsivePopover as OriginalResponsivePopover } from './index';
1718
import '@ui5/webcomponents-icons/dist/settings.js';
1819

20+
// todo remove once portals are supported inline, or popovers are supported w/o having to mount them to the body
21+
const ResponsivePopover = forwardRef<ResponsivePopoverDomRef, ResponsivePopoverPropTypes>((args, ref) =>
22+
createPortal(<OriginalResponsivePopover {...args} ref={ref} />, document.body)
23+
);
24+
ResponsivePopover.displayName = 'ResponsivePopover';
25+
1926
const meta = {
2027
title: 'Modals & Popovers / ResponsivePopover',
2128
component: OriginalResponsivePopover,

0 commit comments

Comments
 (0)
Please sign in to comment.