-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename reusable blocks to patterns & allow user created patterns
- Loading branch information
1 parent
c062fc5
commit e5b1ab7
Showing
20 changed files
with
271 additions
and
35 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
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
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
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
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,55 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useSelect, useDispatch } from '@wordpress/data'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { ToggleControl, PanelRow } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { store as editorStore } from '../../store'; | ||
|
||
export default function PostSyncStatus() { | ||
const { editPost } = useDispatch( editorStore ); | ||
const { meta, postType } = useSelect( ( select ) => { | ||
const { getEditedPostAttribute } = select( editorStore ); | ||
return { | ||
meta: getEditedPostAttribute( 'meta' ), | ||
postType: getEditedPostAttribute( 'type' ), | ||
}; | ||
}, [] ); | ||
if ( postType !== 'wp_block' ) { | ||
return null; | ||
} | ||
const onUpdateSync = ( syncStatus ) => | ||
editPost( { | ||
meta: { | ||
...meta, | ||
wp_block: | ||
syncStatus === 'unsynced' | ||
? { sync_status: syncStatus } | ||
: null, | ||
}, | ||
} ); | ||
const syncStatus = meta?.wp_block?.sync_status; | ||
const isFullySynced = ! syncStatus; | ||
|
||
return ( | ||
<PanelRow className="edit-post-sync-status"> | ||
<span>{ __( 'Syncing' ) }</span> | ||
<ToggleControl | ||
__nextHasNoMarginBottom | ||
label={ | ||
isFullySynced ? __( 'Fully synced' ) : __( 'Not synced' ) | ||
} | ||
checked={ isFullySynced } | ||
onChange={ () => { | ||
onUpdateSync( | ||
syncStatus === 'unsynced' ? 'fully' : 'unsynced' | ||
); | ||
} } | ||
/> | ||
</PanelRow> | ||
); | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/editor/src/components/post-sync-status/style.scss
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,16 @@ | ||
.edit-post-sync-status { | ||
width: 100%; | ||
position: relative; | ||
justify-content: flex-start; | ||
|
||
> span { | ||
display: block; | ||
width: 45%; | ||
flex-shrink: 0; | ||
} | ||
|
||
.components-base-control { | ||
// Match padding on tertiary buttons for alignment. | ||
padding-left: $grid-unit-15 * 0.5; | ||
} | ||
} |
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
Oops, something went wrong.