Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try: Better social links placeholder. #26953

Merged
merged 2 commits into from
Nov 18, 2020
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
9 changes: 6 additions & 3 deletions packages/block-library/src/social-links/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ export function SocialLinksEdit( props ) {

const SocialPlaceholder = (
<div className="wp-block-social-links__social-placeholder">
<div className="wp-social-link wp-social-link-facebook"></div>
<div className="wp-social-link wp-social-link-twitter"></div>
<div className="wp-social-link wp-social-link-instagram"></div>
<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>
);

Expand Down
48 changes: 44 additions & 4 deletions packages/block-library/src/social-links/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,31 @@
.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.1;
}

// Use the first link to set the height.
> .wp-social-link {
// Use !important to keep the selector simple.
padding-left: 0 !important;
margin-left: 0 !important;
padding-right: 0 !important;
margin-right: 0 !important;
width: 0 !important;
visibility: hidden;
}

// Wrap the remaining placeholders in a container so the plus can overlap.
> .wp-block-social-links__social-placeholder-icons {
display: flex;
position: absolute;
}

& + .block-list-appender,
.wp-social-link {
padding: 0.25em;

Expand All @@ -44,16 +68,32 @@

// Polish the Appender.
.wp-block-social-links .block-list-appender {
margin: -$grid-unit-10 0;
display: flex;
align-items: center;
justify-content: center;
margin: 0;

svg {
width: $icon-size;
height: $icon-size;
&::before {
content: "";
display: block;
width: 1em;
height: 1em;
}

.block-editor-inserter {
position: absolute;
}

.block-editor-button-block-appender.block-list-appender__toggle {
margin: 0;
}
}

.wp-block-social-links.is-style-logos-only .block-list-appender {
padding: 4px;
}


// Center flex items. This has an equivalent in style.scss.
.wp-block[data-align="center"] > .wp-block-social-links {
justify-content: center;
Expand Down