Updated schedule post dropdown
This commit is contained in:
parent
09a8778856
commit
9bd0826735
@ -11,11 +11,22 @@ const messages = defineMessages({
|
|||||||
schedule_status: { id: 'schedule_status.title', defaultMessage: 'Schedule Status' },
|
schedule_status: { id: 'schedule_status.title', defaultMessage: 'Schedule Status' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const DatePickerWrapper = ({ value, onClick }) => (
|
class DatePickerWrapper extends React.PureComponent {
|
||||||
<button className="schedule-post-dropdown-wrapper" onClick={onClick}>
|
static propTypes = {
|
||||||
{value}
|
value: PropTypes.string,
|
||||||
</button>
|
onClick: PropTypes.func,
|
||||||
);
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { value, onClick } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button className="schedule-post-dropdown-wrapper" onClick={onClick}>
|
||||||
|
{value}
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default @injectIntl
|
export default @injectIntl
|
||||||
class SchedulePostDropdown extends React.PureComponent {
|
class SchedulePostDropdown extends React.PureComponent {
|
||||||
@ -28,23 +39,14 @@ class SchedulePostDropdown extends React.PureComponent {
|
|||||||
onOpenProUpgradeModal: PropTypes.func.isRequired,
|
onOpenProUpgradeModal: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
|
||||||
open: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
handleToggle = () => {
|
handleToggle = () => {
|
||||||
if (!this.props.isPro) {
|
if (!this.props.isPro) {
|
||||||
return this.props.onOpenProUpgradeModal();
|
return this.props.onOpenProUpgradeModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
const newOpen = !this.state.open;
|
const { date } = this.props;
|
||||||
const newDate = newOpen ? new Date() : null;
|
const value = date ? null : new Date();
|
||||||
|
this.handleSetDate(value);
|
||||||
this.handleSetDate(newDate);
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
open: newOpen
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSetDate = (date) => {
|
handleSetDate = (date) => {
|
||||||
@ -53,7 +55,8 @@ class SchedulePostDropdown extends React.PureComponent {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { intl, date, isPro } = this.props;
|
const { intl, date, isPro } = this.props;
|
||||||
const { open } = this.state;
|
|
||||||
|
const open = !!date;
|
||||||
|
|
||||||
const datePickerDisabled = !isPro;
|
const datePickerDisabled = !isPro;
|
||||||
const withPortal = isMobile(window.innerWidth);
|
const withPortal = isMobile(window.innerWidth);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user