Skip to content

Commit e80fa38

Browse files
committed
MenuItem: add props interface and update to named export --no-verify
1 parent 64bac25 commit e80fa38

File tree

5 files changed

+14
-25
lines changed

5 files changed

+14
-25
lines changed
Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
import PropTypes from 'prop-types';
21
import React from 'react';
3-
import { ButtonOrLink } from '../../common/ButtonOrLink';
2+
import { ButtonOrLink, ButtonOrLinkProps } from '../../common/ButtonOrLink';
43

54
// TODO: combine with NavMenuItem
65

7-
function MenuItem({ hideIf, ...rest }) {
6+
export interface MenuItemProps extends ButtonOrLinkProps {
7+
/**
8+
* Provides a way to deal with optional items.
9+
*/
10+
hideIf?: boolean;
11+
value?: string;
12+
}
13+
14+
export function MenuItem({ hideIf = false, ...rest }: MenuItemProps) {
815
if (hideIf) {
916
return null;
1017
}
@@ -15,21 +22,3 @@ function MenuItem({ hideIf, ...rest }) {
1522
</li>
1623
);
1724
}
18-
19-
MenuItem.propTypes = {
20-
...ButtonOrLink.propTypes,
21-
onClick: PropTypes.func,
22-
value: PropTypes.string,
23-
/**
24-
* Provides a way to deal with optional items.
25-
*/
26-
hideIf: PropTypes.bool
27-
};
28-
29-
MenuItem.defaultProps = {
30-
onClick: null,
31-
value: null,
32-
hideIf: false
33-
};
34-
35-
export default MenuItem;

client/modules/IDE/components/AssetListRow.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Link } from 'react-router-dom';
44
import { useDispatch } from 'react-redux';
55
import { useTranslation } from 'react-i18next';
66
import prettyBytes from 'pretty-bytes';
7-
import MenuItem from '../../../components/Dropdown/MenuItem';
7+
import { MenuItem } from '../../../components/Dropdown/MenuItem';
88
import TableDropdown from '../../../components/Dropdown/TableDropdown';
99
import { deleteAssetRequest } from '../actions/assets';
1010

client/modules/IDE/components/CollectionList/CollectionListRow.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Link } from 'react-router-dom';
55
import { bindActionCreators } from 'redux';
66
import { withTranslation } from 'react-i18next';
77
import styled from 'styled-components';
8-
import MenuItem from '../../../../components/Dropdown/MenuItem';
8+
import { MenuItem } from '../../../../components/Dropdown/MenuItem';
99
import TableDropdown from '../../../../components/Dropdown/TableDropdown';
1010
import * as ProjectActions from '../../actions/project';
1111
import * as CollectionsActions from '../../actions/collections';

client/modules/IDE/components/SketchListRowBase.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { connect } from 'react-redux';
77
import * as ProjectActions from '../actions/project';
88
import * as IdeActions from '../actions/ide';
99
import TableDropdown from '../../../components/Dropdown/TableDropdown';
10-
import MenuItem from '../../../components/Dropdown/MenuItem';
10+
import { MenuItem } from '../../../components/Dropdown/MenuItem';
1111
import { formatDateToString } from '../../../utils/formatDate';
1212
import { getConfig } from '../../../utils/getConfig';
1313
import VisibilityDropdown from '../../User/components/VisibilityDropdown';

client/modules/IDE/components/VersionPicker.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import styled from 'styled-components';
77
import { prop } from '../../../theme';
88
import { useP5Version } from '../hooks/useP5Version';
99
import { p5Versions } from '../../../../common/p5Versions';
10-
import MenuItem from '../../../components/Dropdown/MenuItem';
10+
import { MenuItem } from '../../../components/Dropdown/MenuItem';
1111
import { DropdownMenu } from '../../../components/Dropdown/DropdownMenu';
1212
import { updateFileContent } from '../actions/files';
1313
// eslint-disable-next-line import/no-cycle

0 commit comments

Comments
 (0)