Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Sep 23, 2021
1 parent 1620d51 commit f58abfd
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 20 deletions.
58 changes: 38 additions & 20 deletions packages/block-library/src/cover/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,29 +271,32 @@ function CoverPlaceholder( {
noticeUI,
noticeOperations,
onSelectMedia,
style,
} ) {
const { removeAllNotices, createErrorNotice } = noticeOperations;
return (
<MediaPlaceholder
icon={ <BlockIcon icon={ icon } /> }
labels={ {
title: __( 'Cover' ),
instructions: __(
'Upload an image or video file, or pick one from your media library.'
),
} }
onSelect={ onSelectMedia }
accept="image/*,video/*"
allowedTypes={ ALLOWED_MEDIA_TYPES }
notices={ noticeUI }
disableMediaButtons={ disableMediaButtons }
onError={ ( message ) => {
removeAllNotices();
createErrorNotice( message );
} }
>
{ children }
</MediaPlaceholder>
<div className="cover-block__cover-placeholder-container" style={ style }>
<MediaPlaceholder
icon={ <BlockIcon icon={ icon } /> }
labels={ {
title: __( 'Cover' ),
instructions: __(
'Upload an image or video file, or pick one from your media library.'
),
} }
onSelect={ onSelectMedia }
accept="image/*,video/*"
allowedTypes={ ALLOWED_MEDIA_TYPES }
notices={ noticeUI }
disableMediaButtons={ disableMediaButtons }
onError={ ( message ) => {
removeAllNotices();
createErrorNotice( message );
} }
>
{ children }
</MediaPlaceholder>
</div>
);
}

Expand Down Expand Up @@ -629,10 +632,25 @@ function CoverEdit( {
blockProps.className
) }
>
<ResizableCover
className="block-library-cover__resize-container"
onResizeStart={ () => {
setAttributes( { minHeightUnit: 'px' } );
toggleSelection( false );
} }
onResize={ setTemporaryMinHeight }
onResizeStop={ ( newMinHeight ) => {
toggleSelection( true );
setAttributes( { minHeight: newMinHeight } );
setTemporaryMinHeight( null );
} }
showHandle={ isSelected }
/>
<CoverPlaceholder
noticeUI={ noticeUI }
onSelectMedia={ onSelectMedia }
noticeOperations={ noticeOperations }
style={ { minHeight: temporaryMinHeight || minHeight } }
>
<div className="wp-block-cover__placeholder-background-options">
<ColorPalette
Expand Down
7 changes: 7 additions & 0 deletions packages/block-library/src/cover/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,10 @@
.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover {
background-attachment: scroll;
}

.cover-block__cover-placeholder-container {
background: white;
.block-editor-media-placeholder {
box-shadow: none;
}
}

0 comments on commit f58abfd

Please sign in to comment.