mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-17 15:53:28 +00:00
remove react old defaultProps (#7576)
This commit is contained in:
@@ -94,8 +94,9 @@ class Account extends Component {
|
||||
renderMenu = () => {
|
||||
let data;
|
||||
const { isStaff, isOrgStaff, isInstAdmin } = this.state;
|
||||
const { isAdminPanel = false } = this.props;
|
||||
|
||||
if (this.props.isAdminPanel) {
|
||||
if (isAdminPanel) {
|
||||
if (isStaff) {
|
||||
data = {
|
||||
url: siteRoot,
|
||||
@@ -173,10 +174,6 @@ class Account extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
Account.defaultProps = {
|
||||
isAdminPanel: false
|
||||
};
|
||||
|
||||
Account.propTypes = propTypes;
|
||||
|
||||
export default Account;
|
||||
|
@@ -5,28 +5,7 @@ import { gettext } from '../../../utils/constants';
|
||||
|
||||
import './index.css';
|
||||
|
||||
export default class NotificationPopover extends React.Component {
|
||||
|
||||
static propTypes = {
|
||||
headerText: PropTypes.string.isRequired,
|
||||
bodyText: PropTypes.string.isRequired,
|
||||
footerText: PropTypes.string.isRequired,
|
||||
onNotificationListToggle: PropTypes.func,
|
||||
onNotificationDialogToggle: PropTypes.func,
|
||||
listNotifications: PropTypes.func,
|
||||
onMarkAllNotifications: PropTypes.func,
|
||||
tabItemClick: PropTypes.func,
|
||||
children: PropTypes.any,
|
||||
currentTab: PropTypes.string,
|
||||
generalNoticeListUnseen: PropTypes.number,
|
||||
discussionNoticeListUnseen: PropTypes.number,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
headerText: '',
|
||||
bodyText: '',
|
||||
footerText: '',
|
||||
};
|
||||
class NotificationPopover extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
document.addEventListener('mousedown', this.handleOutsideClick, true);
|
||||
@@ -58,7 +37,7 @@ export default class NotificationPopover extends React.Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { headerText, bodyText, footerText, currentTab, generalNoticeListUnseen, discussionNoticeListUnseen } = this.props;
|
||||
const { headerText = '', bodyText = '', footerText = '', currentTab, generalNoticeListUnseen, discussionNoticeListUnseen } = this.props;
|
||||
return (
|
||||
<Popover
|
||||
className="notification-wrapper"
|
||||
@@ -114,3 +93,20 @@ export default class NotificationPopover extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
NotificationPopover.propTypes = {
|
||||
headerText: PropTypes.string.isRequired,
|
||||
bodyText: PropTypes.string.isRequired,
|
||||
footerText: PropTypes.string.isRequired,
|
||||
onNotificationListToggle: PropTypes.func,
|
||||
onNotificationDialogToggle: PropTypes.func,
|
||||
listNotifications: PropTypes.func,
|
||||
onMarkAllNotifications: PropTypes.func,
|
||||
tabItemClick: PropTypes.func,
|
||||
children: PropTypes.any,
|
||||
currentTab: PropTypes.string,
|
||||
generalNoticeListUnseen: PropTypes.number,
|
||||
discussionNoticeListUnseen: PropTypes.number,
|
||||
};
|
||||
|
||||
export default NotificationPopover;
|
||||
|
@@ -54,47 +54,17 @@ Option.propTypes = {
|
||||
}),
|
||||
};
|
||||
|
||||
export default class SeahubSelect extends React.Component {
|
||||
|
||||
static propTypes = {
|
||||
isMulti: PropTypes.bool,
|
||||
options: PropTypes.array.isRequired,
|
||||
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
|
||||
isSearchable: PropTypes.bool,
|
||||
isClearable: PropTypes.bool,
|
||||
placeholder: PropTypes.string,
|
||||
classNamePrefix: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
form: PropTypes.string,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
menuPortalTarget: PropTypes.string,
|
||||
menuPosition: PropTypes.string,
|
||||
noOptionsMessage: PropTypes.func,
|
||||
innerRef: PropTypes.object,
|
||||
isDisabled: PropTypes.bool,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
options: [],
|
||||
value: {},
|
||||
isDisabled: false,
|
||||
isSearchable: true,
|
||||
isClearable: true,
|
||||
placeholder: '',
|
||||
isMulti: false,
|
||||
menuPortalTarget: '.modal',
|
||||
noOptionsMessage: () => {
|
||||
return null;
|
||||
},
|
||||
};
|
||||
class SeahubSelect extends React.Component {
|
||||
|
||||
getMenuPortalTarget = () => {
|
||||
return document.querySelector(this.props.menuPortalTarget);
|
||||
const { menuPortalTarget = '.modal' } = this.props;
|
||||
return document.querySelector(menuPortalTarget);
|
||||
};
|
||||
|
||||
render() {
|
||||
const { options, onChange, value, isSearchable, placeholder, isMulti, menuPosition, isClearable, noOptionsMessage,
|
||||
classNamePrefix, innerRef, isDisabled, form, className } = this.props;
|
||||
const { options = [], onChange, value = {}, isSearchable = true, placeholder = '',
|
||||
isMulti = false, menuPosition, isClearable = true, noOptionsMessage = (() => { return null; }),
|
||||
classNamePrefix, innerRef, isDisabled = false, form, className } = this.props;
|
||||
|
||||
return (
|
||||
<Select
|
||||
@@ -121,3 +91,23 @@ export default class SeahubSelect extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SeahubSelect.propTypes = {
|
||||
isMulti: PropTypes.bool,
|
||||
options: PropTypes.array.isRequired,
|
||||
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
|
||||
isSearchable: PropTypes.bool,
|
||||
isClearable: PropTypes.bool,
|
||||
placeholder: PropTypes.string,
|
||||
classNamePrefix: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
form: PropTypes.string,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
menuPortalTarget: PropTypes.string,
|
||||
menuPosition: PropTypes.string,
|
||||
noOptionsMessage: PropTypes.func,
|
||||
innerRef: PropTypes.object,
|
||||
isDisabled: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default SeahubSelect;
|
||||
|
Reference in New Issue
Block a user