Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/block-library/src/social-links/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export function SocialLinksEdit( props ) {
attributes,
iconBackgroundColor,
iconColor,
isSelected,
setAttributes,
setIconBackgroundColor,
setIconColor,
Expand Down Expand Up @@ -72,14 +73,20 @@ export function SocialLinksEdit( props ) {
}, [ logosOnly, setAttributes ] );

const SocialPlaceholder = (
<div className="wp-block-social-links__social-placeholder">
<li className="wp-block-social-links__social-placeholder">
<div className="wp-social-link"></div>
<div className="wp-block-social-links__social-placeholder-icons">
<div className="wp-social-link wp-social-link-twitter"></div>
<div className="wp-social-link wp-social-link-facebook"></div>
<div className="wp-social-link wp-social-link-instagram"></div>
</div>
</div>
</li>
);

const SelectedSocialPlaceholder = (
<li className="wp-block-social-links__social-prompt">
{ __( 'Click plus to add' ) }
</li>
);

// Fallback color values are used maintain selections in case switching
Expand All @@ -95,7 +102,7 @@ export function SocialLinksEdit( props ) {
const innerBlocksProps = useInnerBlocksProps( blockProps, {
allowedBlocks: ALLOWED_BLOCKS,
orientation: 'horizontal',
placeholder: SocialPlaceholder,
placeholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,
templateLock: false,
__experimentalAppenderTagName: 'li',
} );
Expand Down
31 changes: 20 additions & 11 deletions packages/block-library/src/social-links/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
.wp-block-social-links__social-placeholder {
display: flex;
opacity: 0.8;
transition: all 0.1s ease-in-out;
@include reduce-motion("transition");

.is-selected > & {
opacity: 0;
width: 0; // This allows the appender to sit on the left as it should.
}
list-style: none;

// Use the first link to set the height.
> .wp-social-link {
Expand Down Expand Up @@ -53,10 +47,6 @@
}
}

& + .block-list-appender {
box-shadow: inset 0 0 0 $border-width $gray-700;
}

.wp-social-link::before {
content: "";
display: block;
Expand All @@ -70,6 +60,25 @@
}
}

// Selected placeholder state.
.wp-block-social-links .wp-block-social-links__social-prompt {
list-style: none;
order: 2; // Move after the appender button. Because this element is non-interactive, it does not affect tab order.

// Show as block UI.
font-family: $default-font;
font-size: $default-font-size;
line-height: $button-size-small;
margin-top: auto;
margin-bottom: auto;
cursor: default;

& + .block-list-appender {
margin-right: $grid-unit-10;
padding: 0.25em;
}
}

// Polish the Appender.
.wp-block-social-links .block-list-appender {
// Match the overall silhouette of social links.
Expand Down