Skip to content

Commit 7944cfe

Browse files
authored
feat: fix wrong menu item component from forma (#1934)
* feat: fix wrong menu item component from forma * feat: import section title directly
1 parent 24fe7db commit 7944cfe

File tree

5 files changed

+28
-597
lines changed

5 files changed

+28
-597
lines changed

apps/entry-app-collapsible/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"@contentful/f36-components": "^5.1.1",
99
"@contentful/f36-icons": "^5.4.0",
1010
"@contentful/f36-tokens": "^5.1.0",
11-
"@contentful/field-editor-rich-text": "^3.27.7",
12-
"@contentful/field-editor-shared": "^1.6.2",
13-
"@contentful/field-editor-single-line": "^1.4.5",
11+
"@contentful/field-editor-rich-text": "^4.12.2",
12+
"@contentful/field-editor-shared": "^2.12.2",
13+
"@contentful/field-editor-single-line": "^1.8.5",
1414
"emotion": "^10.0.17",
1515
"prop-types": "^15.7.2",
1616
"react": "^18.3.1",

apps/rich-text-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"@contentful/app-sdk": "^4.17.1",
77
"@contentful/f36-components": "^5.1.1",
88
"@contentful/f36-tokens": "^5.1.0",
9-
"@contentful/field-editor-rich-text": "^3.4.21",
10-
"@contentful/field-editor-single-line": "^1.2.0",
9+
"@contentful/field-editor-rich-text": "^4.12.2",
10+
"@contentful/field-editor-single-line": "^1.8.5",
1111
"react": "^18.3.1",
1212
"react-dom": "^18.3.1"
1313
},

packages/reference/src/assets/WrappedAssetCard/AssetCardActions.tsx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
import { Menu, Text } from '@contentful/f36-components';
3+
import { MenuItem, Text, MenuSectionTitle } from '@contentful/f36-components';
44
import tokens from '@contentful/f36-tokens';
55
import { shortenStorageUnit } from '@contentful/field-editor-shared';
66
import { css } from 'emotion';
@@ -57,8 +57,8 @@ export function renderAssetInfo(props: { entityFile: File }) {
5757
const image = get(entityFile, 'details.image');
5858

5959
return [
60-
<Menu.SectionTitle key="file-section">File info</Menu.SectionTitle>,
61-
<Menu.Item
60+
<MenuSectionTitle key="file-section">File info</MenuSectionTitle>,
61+
<MenuItem
6262
key="file-information"
6363
className={styles.fileInformation.menuItem}
6464
isDisabled
@@ -94,8 +94,8 @@ export function renderAssetInfo(props: { entityFile: File }) {
9494
</>
9595
)}
9696
</dl>
97-
</Menu.Item>,
98-
].map((item, i) => <Menu key={i}>{item}</Menu>);
97+
</MenuItem>,
98+
];
9999
}
100100

101101
export function renderActions(props: {
@@ -107,14 +107,14 @@ export function renderActions(props: {
107107
const { entityFile, isDisabled, onEdit, onRemove } = props;
108108

109109
return [
110-
<Menu.SectionTitle key="section-title">Actions</Menu.SectionTitle>,
110+
<MenuSectionTitle key="section-title">Actions</MenuSectionTitle>,
111111
onEdit ? (
112-
<Menu.Item key="edit" onClick={onEdit} testId="card-action-edit">
112+
<MenuItem key="edit" onClick={onEdit} testId="card-action-edit">
113113
Edit
114-
</Menu.Item>
114+
</MenuItem>
115115
) : null,
116116
entityFile ? (
117-
<Menu.Item
117+
<MenuItem
118118
key="download"
119119
onClick={() => {
120120
if (typeof entityFile.url === 'string') {
@@ -124,14 +124,12 @@ export function renderActions(props: {
124124
testId="card-action-download"
125125
>
126126
Download
127-
</Menu.Item>
127+
</MenuItem>
128128
) : null,
129129
onRemove && !isDisabled ? (
130-
<Menu.Item key="remove" onClick={onRemove} testId="card-action-remove">
130+
<MenuItem key="remove" onClick={onRemove} testId="card-action-remove">
131131
Remove
132-
</Menu.Item>
132+
</MenuItem>
133133
) : null,
134-
]
135-
.filter((item) => item)
136-
.map((item, i) => <Menu key={i}>{item}</Menu>);
134+
].filter((item) => item);
137135
}

packages/reference/src/entries/WrappedEntryCard/WrappedEntryCard.tsx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22

33
import { SpaceAPI } from '@contentful/app-sdk';
4-
import { EntryCard, Menu, MenuDivider } from '@contentful/f36-components';
4+
import { EntryCard, MenuDivider, MenuItem } from '@contentful/f36-components';
55
import {
66
entityHelpers,
77
isValidImage,
@@ -178,51 +178,45 @@ export function WrappedEntryCard({
178178
onEdit || onRemove
179179
? [
180180
hasCardEditActions && onEdit ? (
181-
<Menu.Item
181+
<MenuItem
182182
key="edit"
183183
testId="edit"
184184
onClick={() => {
185185
onEdit && onEdit();
186186
}}
187187
>
188188
Edit
189-
</Menu.Item>
189+
</MenuItem>
190190
) : null,
191191
hasCardRemoveActions && onRemove && !isDisabled ? (
192-
<Menu.Item
192+
<MenuItem
193193
key="delete"
194194
testId="delete"
195195
onClick={() => {
196196
onRemove && onRemove();
197197
}}
198198
>
199199
Remove
200-
</Menu.Item>
200+
</MenuItem>
201201
) : null,
202202
hasCardMoveActions && (onMoveTop || onMoveBottom) && !isDisabled ? (
203203
<MenuDivider key="divider" />
204204
) : null,
205205
hasCardMoveActions && onMoveTop && !isDisabled ? (
206-
<Menu.Item
207-
key="move-top"
208-
onClick={() => onMoveTop && onMoveTop()}
209-
testId="move-top"
210-
>
206+
<MenuItem key="move-top" onClick={() => onMoveTop && onMoveTop()} testId="move-top">
211207
Move to top
212-
</Menu.Item>
208+
</MenuItem>
213209
) : null,
214210
hasCardMoveActions && onMoveBottom && !isDisabled ? (
215-
<Menu.Item
211+
<MenuItem
216212
key="move-bottom"
217213
onClick={() => onMoveBottom && onMoveBottom()}
218214
testId="move-bottom"
219215
>
220216
Move to bottom
221-
</Menu.Item>
217+
</MenuItem>
222218
) : null,
223-
]
224-
.filter((item) => item)
225-
.map((item, i) => <Menu key={i}>{item}</Menu>)
219+
].filter((item) => item)
226220
: []
227221
}
228222
onClick={

0 commit comments

Comments
 (0)