Updates for missing vars in components

This commit is contained in:
mgabdev
2020-01-27 14:46:42 -05:00
parent a2b5d72e08
commit 6c8eea5160
15 changed files with 49 additions and 37 deletions

View File

@@ -64,9 +64,7 @@ class Account extends ImmutablePureComponent {
render() {
const { account, intl, hidden, onActionClick, actionIcon, actionTitle, displayOnly } = this.props;
if (!account) {
return <div />;
}
if (!account) return null;
if (hidden) {
return (

View File

@@ -9,12 +9,12 @@ export default class ColumnHeaderSettingButton extends PureComponent {
static propTypes = {
title: PropTypes.node.isRequired,
icon: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
onClick: PropTypes.func,
to: PropTypes.string,
};
render () {
const { title, icon, to } = this.props;
const { title, icon, to, onClick } = this.props;
const classes = classNames('column-header-setting-btn', {
'column-header-setting-btn--link': !!to
@@ -30,7 +30,7 @@ export default class ColumnHeaderSettingButton extends PureComponent {
}
return (
<button className={classes} tabIndex='0' onClick={this.props.onClick}>
<button className={classes} tabIndex='0' onClick={onClick}>
<Icon id={icon} />
{title}
</button>

View File

@@ -3,6 +3,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { openModal } from '../../../actions/modal';
import { cancelReplyCompose } from '../../../actions/compose';
import ModalLayout from '../modal_layout';
import TimelineComposeBlock from '../../timeline_compose_block';
const messages = defineMessages({
confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
@@ -46,7 +47,7 @@ class ComposeModal extends ImmutablePureComponent {
const { intl } = this.props;
return (
<ModalLayout title={intl.formatMessage(messages.title)} onClose={onClickClose}>
<ModalLayout title={intl.formatMessage(messages.title)} onClose={this.onClickClose}>
<TimelineComposeBlock />
</ModalLayout>
);

View File

@@ -16,7 +16,7 @@ class ModalLayout extends PureComponent {
};
render() {
const { title, children } = this.props;
const { title, children, intl, onClose } = this.props;
return (
<div className='modal modal--layout modal--root'>

View File

@@ -8,7 +8,7 @@ class SectionHeadlineBarItem extends PureComponent {
icon: PropTypes.string,
className: PropTypes.string,
onClick: PropTypes.func,
title: PropTypes.oneOf([
title: PropTypes.oneOfType([
PropTypes.string,
PropTypes.node,
]),
@@ -21,14 +21,20 @@ class SectionHeadlineBarItem extends PureComponent {
const classes = classNames('section-header-bar__item', className);
if (to) {
return (<NavLink className={classes} exact={exact} to={to}>{title}</NavLink>);
return (
<NavLink className={classes} exact={exact} to={to}>{title}</NavLink>
)
} else if (icon) {
<button className={classes} onClick={onClick} title={title}>
<Icon id={icon} fixedWidth />
</button>
return (
<button className={classes} onClick={onClick} title={title}>
<Icon id={icon} fixedWidth />
</button>
)
}
return (<button className={classes} onClick={onClick}>{title}</button>)
return (
<button className={classes} onClick={onClick}>{title}</button>
)
}
};
@@ -46,8 +52,8 @@ export default class SectionHeadlineBar extends PureComponent {
return (
<div className={classes}>
{
items.forEach(item, i => (
<SectionHeadlineBarItem key={`shbi-{i}`} {...item} />
items.forEach((item, i) => (
<SectionHeadlineBarItem key={`shbi-${i}`} {...item} />
))
}
</div>

View File

@@ -14,6 +14,8 @@ export default class TrendingItem extends ImmutablePureComponent {
};
render() {
const { hashtag } = this.props;
return (
<div className='trending-item'>
<div className='trending-item__text'>