chore: add missing react prop types (#1651)
This commit is contained in:
@ -59,6 +59,7 @@ class App extends React.Component {
|
||||
isFetching: PropTypes.bool.isRequired,
|
||||
publishMode: PropTypes.oneOf([SIMPLE, EDITORIAL_WORKFLOW]),
|
||||
siteId: PropTypes.string,
|
||||
openMediaLibrary: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
static configError(config) {
|
||||
|
@ -105,6 +105,8 @@ export default class Header extends React.Component {
|
||||
collections: ImmutablePropTypes.orderedMap.isRequired,
|
||||
onCreateEntryClick: PropTypes.func.isRequired,
|
||||
onLogoutClick: PropTypes.func.isRequired,
|
||||
openMediaLibrary: PropTypes.func.isRequired,
|
||||
hasWorkflow: PropTypes.bool.isRequired,
|
||||
displayUrl: PropTypes.string,
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import styled from 'react-emotion';
|
||||
import { connect } from 'react-redux';
|
||||
@ -20,6 +21,9 @@ const CollectionMain = styled.main`
|
||||
|
||||
class Collection extends React.Component {
|
||||
static propTypes = {
|
||||
searchTerm: PropTypes.string,
|
||||
collectionName: PropTypes.string,
|
||||
isSearchResults: PropTypes.bool,
|
||||
collection: ImmutablePropTypes.map.isRequired,
|
||||
collections: ImmutablePropTypes.orderedMap.isRequired,
|
||||
};
|
||||
|
@ -105,7 +105,10 @@ const CollectionTop = ({
|
||||
|
||||
CollectionTop.propTypes = {
|
||||
collectionLabel: PropTypes.string.isRequired,
|
||||
collectionLabelSingular: PropTypes.string,
|
||||
collectionDescription: PropTypes.string,
|
||||
viewStyle: PropTypes.oneOf([VIEW_STYLE_LIST, VIEW_STYLE_GRID]).isRequired,
|
||||
onChangeViewStyle: PropTypes.func.isRequired,
|
||||
newEntryUrl: PropTypes.string,
|
||||
};
|
||||
|
||||
|
@ -18,10 +18,11 @@ const CardsGrid = styled.ul`
|
||||
export default class EntryListing extends React.Component {
|
||||
static propTypes = {
|
||||
publicFolder: PropTypes.string.isRequired,
|
||||
collections: PropTypes.oneOfType([ImmutablePropTypes.map, ImmutablePropTypes.iterable])
|
||||
.isRequired,
|
||||
collections: ImmutablePropTypes.iterable.isRequired,
|
||||
entries: ImmutablePropTypes.list,
|
||||
viewStyle: PropTypes.string,
|
||||
cursor: PropTypes.any.isRequired,
|
||||
handleCursorActions: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
handleLoadMore = () => {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import styled, { css } from 'react-emotion';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
@ -89,9 +90,14 @@ const SidebarNavLink = styled(NavLink)`
|
||||
export default class Sidebar extends React.Component {
|
||||
static propTypes = {
|
||||
collections: ImmutablePropTypes.orderedMap.isRequired,
|
||||
searchTerm: PropTypes.string,
|
||||
};
|
||||
|
||||
state = { query: this.props.searchTerm || '' };
|
||||
static defaultProps = {
|
||||
searchTerm: '',
|
||||
};
|
||||
|
||||
state = { query: this.props.searchTerm };
|
||||
|
||||
renderLink = collection => {
|
||||
const collectionName = collection.get('name');
|
||||
|
@ -61,8 +61,14 @@ class Editor extends React.Component {
|
||||
updateUnpublishedEntryStatus: PropTypes.func.isRequired,
|
||||
publishUnpublishedEntry: PropTypes.func.isRequired,
|
||||
deleteUnpublishedEntry: PropTypes.func.isRequired,
|
||||
currentStatus: PropTypes.string,
|
||||
logoutUser: PropTypes.func.isRequired,
|
||||
loadEntries: PropTypes.func.isRequired,
|
||||
currentStatus: PropTypes.string,
|
||||
user: ImmutablePropTypes.map.isRequired,
|
||||
location: PropTypes.shape({
|
||||
pathname: PropTypes.string,
|
||||
}),
|
||||
hasChanged: PropTypes.bool,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
|
@ -1,4 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import styled, { css, cx } from 'react-emotion';
|
||||
import { partial, uniqueId } from 'lodash';
|
||||
import { connect } from 'react-redux';
|
||||
@ -113,6 +115,30 @@ export const ControlHint = styled.p`
|
||||
`;
|
||||
|
||||
class EditorControl extends React.Component {
|
||||
static propTypes = {
|
||||
value: PropTypes.oneOfType([
|
||||
PropTypes.node,
|
||||
PropTypes.object,
|
||||
PropTypes.string,
|
||||
PropTypes.bool,
|
||||
]),
|
||||
field: ImmutablePropTypes.map.isRequired,
|
||||
fieldsMetaData: ImmutablePropTypes.map,
|
||||
fieldsErrors: ImmutablePropTypes.map,
|
||||
mediaPaths: ImmutablePropTypes.map.isRequired,
|
||||
boundGetAsset: PropTypes.func.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
openMediaLibrary: PropTypes.func.isRequired,
|
||||
addAsset: PropTypes.func.isRequired,
|
||||
removeInsertedMedia: PropTypes.func.isRequired,
|
||||
onValidate: PropTypes.func,
|
||||
processControlRef: PropTypes.func,
|
||||
query: PropTypes.func.isRequired,
|
||||
queryHits: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
||||
isFetching: PropTypes.bool,
|
||||
clearSearch: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
state = {
|
||||
activeLabel: false,
|
||||
};
|
||||
|
@ -44,6 +44,8 @@ export default class Widget extends Component {
|
||||
query: PropTypes.func.isRequired,
|
||||
clearSearch: PropTypes.func.isRequired,
|
||||
queryHits: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
||||
editorControl: PropTypes.func.isRequired,
|
||||
uniqueFieldId: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
|
@ -281,7 +281,7 @@ EditorInterface.propTypes = {
|
||||
onDeleteUnpublishedChanges: PropTypes.func.isRequired,
|
||||
onPublish: PropTypes.func.isRequired,
|
||||
onChangeStatus: PropTypes.func.isRequired,
|
||||
user: ImmutablePropTypes.map,
|
||||
user: ImmutablePropTypes.map.isRequired,
|
||||
hasChanged: PropTypes.bool,
|
||||
displayUrl: PropTypes.string,
|
||||
hasWorkflow: PropTypes.bool,
|
||||
|
@ -25,4 +25,9 @@ PreviewContent.contextTypes = {
|
||||
document: PropTypes.any,
|
||||
};
|
||||
|
||||
PreviewContent.propTypes = {
|
||||
previewComponent: PropTypes.func.isRequired,
|
||||
previewProps: PropTypes.object,
|
||||
};
|
||||
|
||||
export default PreviewContent;
|
||||
|
@ -1,4 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
|
||||
class PreviewHOC extends React.Component {
|
||||
/**
|
||||
@ -17,4 +19,10 @@ class PreviewHOC extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
PreviewHOC.propTypes = {
|
||||
previewComponent: PropTypes.func.isRequired,
|
||||
field: ImmutablePropTypes.map.isRequired,
|
||||
value: PropTypes.oneOfType([PropTypes.node, PropTypes.object, PropTypes.string, PropTypes.bool]),
|
||||
};
|
||||
|
||||
export default PreviewHOC;
|
||||
|
@ -180,7 +180,7 @@ export default class EditorToolbar extends React.Component {
|
||||
onChangeStatus: PropTypes.func.isRequired,
|
||||
onPublish: PropTypes.func.isRequired,
|
||||
onPublishAndNew: PropTypes.func.isRequired,
|
||||
user: ImmutablePropTypes.map,
|
||||
user: ImmutablePropTypes.map.isRequired,
|
||||
hasChanged: PropTypes.bool,
|
||||
displayUrl: PropTypes.string,
|
||||
collection: ImmutablePropTypes.map.isRequired,
|
||||
|
@ -1,4 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import { connect } from 'react-redux';
|
||||
import { orderBy, map } from 'lodash';
|
||||
import { Map } from 'immutable';
|
||||
@ -21,7 +23,41 @@ import MediaLibraryModal from './MediaLibraryModal';
|
||||
const IMAGE_EXTENSIONS_VIEWABLE = ['jpg', 'jpeg', 'webp', 'gif', 'png', 'bmp', 'tiff', 'svg'];
|
||||
const IMAGE_EXTENSIONS = [...IMAGE_EXTENSIONS_VIEWABLE];
|
||||
|
||||
const fileShape = {
|
||||
key: PropTypes.string.isRequired,
|
||||
name: PropTypes.string.isRequired,
|
||||
size: PropTypes.number.isRequired,
|
||||
queryOrder: PropTypes.number,
|
||||
url: PropTypes.string.isRequired,
|
||||
urlIsPublicPath: PropTypes.bool,
|
||||
};
|
||||
|
||||
class MediaLibrary extends React.Component {
|
||||
static propTypes = {
|
||||
isVisible: PropTypes.bool,
|
||||
loadMediaDisplayURL: PropTypes.func,
|
||||
displayURLs: ImmutablePropTypes.map,
|
||||
canInsert: PropTypes.bool,
|
||||
files: PropTypes.arrayOf(PropTypes.shape(fileShape)).isRequired,
|
||||
dynamicSearch: PropTypes.bool,
|
||||
dynamicSearchActive: PropTypes.bool,
|
||||
forImage: PropTypes.bool,
|
||||
isLoading: PropTypes.bool,
|
||||
isPersisting: PropTypes.bool,
|
||||
isDeleting: PropTypes.bool,
|
||||
hasNextPage: PropTypes.bool,
|
||||
isPaginating: PropTypes.bool,
|
||||
privateUpload: PropTypes.bool,
|
||||
loadMedia: PropTypes.func.isRequired,
|
||||
dynamicSearchQuery: PropTypes.string,
|
||||
page: PropTypes.number,
|
||||
persistMedia: PropTypes.func.isRequired,
|
||||
deleteMedia: PropTypes.func.isRequired,
|
||||
insertMedia: PropTypes.func.isRequired,
|
||||
publicFolder: PropTypes.string,
|
||||
closeMediaLibrary: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
/**
|
||||
* The currently selected file and query are tracked in component state as
|
||||
* they do not impact the rest of the application.
|
||||
|
@ -25,6 +25,7 @@ export const DragSource = ({ namespace, ...props }) => {
|
||||
return React.createElement(DragComponent, props, props.children);
|
||||
};
|
||||
DragSource.propTypes = {
|
||||
namespace: PropTypes.any.isRequired,
|
||||
children: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
@ -46,6 +47,7 @@ export const DropTarget = ({ onDrop, namespace, ...props }) => {
|
||||
};
|
||||
DropTarget.propTypes = {
|
||||
onDrop: PropTypes.func.isRequired,
|
||||
namespace: PropTypes.any.isRequired,
|
||||
children: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { css } from 'react-emotion';
|
||||
import { colors } from 'netlify-cms-ui-default';
|
||||
|
||||
@ -14,6 +15,10 @@ const styles = {
|
||||
};
|
||||
|
||||
export class ErrorBoundary extends React.Component {
|
||||
static propTypes = {
|
||||
children: PropTypes.node,
|
||||
};
|
||||
|
||||
state = {
|
||||
hasError: false,
|
||||
errorMessage: '',
|
||||
|
@ -14,6 +14,7 @@ export const FileUploadButton = ({ label, imagesOnly, onChange, disabled, classN
|
||||
);
|
||||
|
||||
FileUploadButton.propTypes = {
|
||||
className: PropTypes.string,
|
||||
label: PropTypes.string.isRequired,
|
||||
imagesOnly: PropTypes.bool,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styled, { css } from 'react-emotion';
|
||||
import { Icon, Dropdown, DropdownItem, DropdownButton, colors } from 'netlify-cms-ui-default';
|
||||
import { stripProtocol } from 'Lib/urlHelper';
|
||||
@ -42,6 +43,10 @@ const Avatar = ({ imageUrl }) => (
|
||||
</AppHeaderAvatar>
|
||||
);
|
||||
|
||||
Avatar.propTypes = {
|
||||
imageUrl: PropTypes.string,
|
||||
};
|
||||
|
||||
const SettingsDropdown = ({ displayUrl, imageUrl, onLogoutClick }) => (
|
||||
<React.Fragment>
|
||||
{displayUrl ? (
|
||||
@ -64,4 +69,10 @@ const SettingsDropdown = ({ displayUrl, imageUrl, onLogoutClick }) => (
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
SettingsDropdown.propTypes = {
|
||||
displayUrl: PropTypes.string,
|
||||
imageUrl: PropTypes.string,
|
||||
onLogoutClick: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default SettingsDropdown;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styled, { css } from 'react-emotion';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { components, colors, colorsRaw, transitions, buttons } from 'netlify-cms-ui-default';
|
||||
@ -127,4 +128,17 @@ const WorkflowCard = ({
|
||||
</WorkflowCardContainer>
|
||||
);
|
||||
|
||||
WorkflowCard.propTypes = {
|
||||
collectionName: PropTypes.string.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
authorLastChange: PropTypes.string.isRequired,
|
||||
body: PropTypes.string.isRequired,
|
||||
isModification: PropTypes.bool,
|
||||
editLink: PropTypes.string.isRequired,
|
||||
timestamp: PropTypes.string.isRequired,
|
||||
onDelete: PropTypes.func.isRequired,
|
||||
canPublish: PropTypes.bool.isRequired,
|
||||
onPublish: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default WorkflowCard;
|
||||
|
Reference in New Issue
Block a user