-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79a74be
commit 0c97780
Showing
4 changed files
with
253 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** | ||
* External Dependencies | ||
*/ | ||
import { connect } from 'react-redux'; | ||
|
||
/** | ||
* WordPress Dependencies | ||
*/ | ||
import { PanelBody, Button, ClipboardButton } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { Component } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal Dependencies | ||
*/ | ||
import { getCurrentPost } from '../../store/selectors'; | ||
|
||
class PostPublishPanelPostpublish extends Component { | ||
constructor() { | ||
super( ...arguments ); | ||
this.state = { | ||
showCopyConfirmation: false, | ||
}; | ||
this.onCopy = this.onCopy.bind( this ); | ||
this.onSelectInput = this.onSelectInput.bind( this ); | ||
} | ||
|
||
componentWillUnmount() { | ||
clearTimeout( this.dismissCopyConfirmation ); | ||
} | ||
|
||
onCopy() { | ||
this.setState( { | ||
showCopyConfirmation: true, | ||
} ); | ||
|
||
clearTimeout( this.dismissCopyConfirmation ); | ||
this.dismissCopyConfirmation = setTimeout( () => { | ||
this.setState( { | ||
showCopyConfirmation: false, | ||
} ); | ||
}, 4000 ); | ||
} | ||
|
||
onSelectInput( event ) { | ||
event.target.select(); | ||
} | ||
|
||
render() { | ||
const { post } = this.props; | ||
|
||
return ( | ||
<div className="post-publish-panel__postpublish"> | ||
<PanelBody className="post-publish-panel__postpublish-header"> | ||
<a href={ post.link }>{ post.title || __( '(no title)' ) }</a>{ __( ' is now live.' ) } | ||
</PanelBody> | ||
<PanelBody> | ||
<div><strong>{ __( 'What\'s next?' ) }</strong></div> | ||
<input | ||
className="post-publish-panel__postpublish-link-input" | ||
type="text" | ||
readOnly | ||
value={ post.link } | ||
onClick={ this.onSelectInput } | ||
/> | ||
<div className="post-publish-panel__postpublish-buttons"> | ||
<Button className="button" href={ post.link }> | ||
{ __( 'View Post' ) } | ||
</Button> | ||
|
||
<ClipboardButton className="button" text={ post.link } onCopy={ this.onCopy }> | ||
{ this.state.showCopyConfirmation ? __( 'Copied!' ) : __( 'Copy Link' ) } | ||
</ClipboardButton> | ||
</div> | ||
</PanelBody> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default connect( | ||
state => ( { | ||
post: getCurrentPost( state ), | ||
} ) | ||
)( PostPublishPanelPostpublish ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { PanelBody } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal Dependencies | ||
*/ | ||
import PostVisibility from '../post-visibility'; | ||
import PostVisibilityLabel from '../post-visibility/label'; | ||
import PostSchedule from '../post-schedule'; | ||
import PostScheduleLabel from '../post-schedule/label'; | ||
|
||
function PostPublishPanelPrepublish() { | ||
return ( | ||
<div className="editor-post-publish-panel__prepublish"> | ||
<div><strong>{ __( 'All ready to go?' ) }</strong></div> | ||
<p>{ __( 'Here, you can do a last-minute check up of your settings below, before you publish.' ) }</p> | ||
<PanelBody initialOpen={ false } title={ [ | ||
__( 'Visibility: ' ), | ||
<span className="editor-post-publish-panel__link" key="label"><PostVisibilityLabel /></span>, | ||
] }> | ||
<PostVisibility /> | ||
</PanelBody> | ||
<PanelBody initialOpen={ false } title={ [ | ||
__( 'Publish: ' ), | ||
<span className="editor-post-publish-panel__link" key="label"><PostScheduleLabel /></span>, | ||
] }> | ||
<PostSchedule /> | ||
</PanelBody> | ||
</div> | ||
); | ||
} | ||
|
||
export default PostPublishPanelPrepublish; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters