File tree Expand file tree Collapse file tree 5 files changed +14
-25
lines changed Expand file tree Collapse file tree 5 files changed +14
-25
lines changed Original file line number Diff line number Diff line change 1- import PropTypes from 'prop-types' ;
21import 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 ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { Link } from 'react-router-dom';
44import { useDispatch } from 'react-redux' ;
55import { useTranslation } from 'react-i18next' ;
66import prettyBytes from 'pretty-bytes' ;
7- import MenuItem from '../../../components/Dropdown/MenuItem' ;
7+ import { MenuItem } from '../../../components/Dropdown/MenuItem' ;
88import TableDropdown from '../../../components/Dropdown/TableDropdown' ;
99import { deleteAssetRequest } from '../actions/assets' ;
1010
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { Link } from 'react-router-dom';
55import { bindActionCreators } from 'redux' ;
66import { withTranslation } from 'react-i18next' ;
77import styled from 'styled-components' ;
8- import MenuItem from '../../../../components/Dropdown/MenuItem' ;
8+ import { MenuItem } from '../../../../components/Dropdown/MenuItem' ;
99import TableDropdown from '../../../../components/Dropdown/TableDropdown' ;
1010import * as ProjectActions from '../../actions/project' ;
1111import * as CollectionsActions from '../../actions/collections' ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { connect } from 'react-redux';
77import * as ProjectActions from '../actions/project' ;
88import * as IdeActions from '../actions/ide' ;
99import TableDropdown from '../../../components/Dropdown/TableDropdown' ;
10- import MenuItem from '../../../components/Dropdown/MenuItem' ;
10+ import { MenuItem } from '../../../components/Dropdown/MenuItem' ;
1111import { formatDateToString } from '../../../utils/formatDate' ;
1212import { getConfig } from '../../../utils/getConfig' ;
1313import VisibilityDropdown from '../../User/components/VisibilityDropdown' ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import styled from 'styled-components';
77import { prop } from '../../../theme' ;
88import { useP5Version } from '../hooks/useP5Version' ;
99import { p5Versions } from '../../../../common/p5Versions' ;
10- import MenuItem from '../../../components/Dropdown/MenuItem' ;
10+ import { MenuItem } from '../../../components/Dropdown/MenuItem' ;
1111import { DropdownMenu } from '../../../components/Dropdown/DropdownMenu' ;
1212import { updateFileContent } from '../actions/files' ;
1313// eslint-disable-next-line import/no-cycle
You can’t perform that action at this time.
0 commit comments