-
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.
Add the Done button from to the template editing mode
- Loading branch information
1 parent
00dcf84
commit 706b9fe
Showing
9 changed files
with
103 additions
and
36 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
50 changes: 50 additions & 0 deletions
50
packages/edit-post/src/components/header/template-save-button/index.js
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,50 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { EntitiesSavedStates } from '@wordpress/editor'; | ||
import { Button } from '@wordpress/components'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useState } from '@wordpress/element'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { useDispatch } from '@wordpress/data'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { ActionsPanelFill } from '../../layout/actions-panel'; | ||
import { store as editPostStore } from '../../../store'; | ||
|
||
function TemplateSaveButton() { | ||
const [ | ||
isEntitiesReviewPanelOpen, | ||
setIsEntitiesReviewPanelOpen, | ||
] = useState( false ); | ||
const { setIsEditingTemplate } = useDispatch( editPostStore ); | ||
return ( | ||
<> | ||
<Button | ||
isPrimary | ||
onClick={ () => setIsEntitiesReviewPanelOpen( true ) } | ||
aria-expanded={ false } | ||
> | ||
{ __( 'Done' ) } | ||
</Button> | ||
<ActionsPanelFill> | ||
<EntitiesSavedStates | ||
isOpen={ isEntitiesReviewPanelOpen } | ||
close={ ( entities ) => { | ||
setIsEntitiesReviewPanelOpen( false ); | ||
if ( entities.length ) { | ||
setIsEditingTemplate( false ); | ||
} | ||
} } | ||
/> | ||
</ActionsPanelFill> | ||
</> | ||
); | ||
} | ||
|
||
export default TemplateSaveButton; |
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
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 |
---|---|---|
|
@@ -5,6 +5,9 @@ | |
span { | ||
display: block; | ||
width: 45%; | ||
padding-left: 6px; | ||
} | ||
} | ||
|
||
.edit-post-post-template__value { | ||
padding-left: 6px; | ||
} |
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