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

Fixed Social Icons shape, and horizontal and vertical alignments (fixes #28340) #28448

Merged
merged 2 commits into from
Feb 3, 2021
Merged

Fixed Social Icons shape, and horizontal and vertical alignments (fixes #28340) #28448

merged 2 commits into from
Feb 3, 2021

Conversation

Arash-11
Copy link
Contributor

@Arash-11 Arash-11 commented Jan 23, 2021

Fixes #28340

Original issue was that when adding Social Icons to a Navigation block, the icons would be oblong instead of circle. The icons only misshapened when size Small or Normal was selected.

I also noticed that when a horizontal Nav block was added, the social icons wouldn't align horizontally, and in a vertical Nav block, the social icons wouldn't align vertically.

@Arash-11 Arash-11 requested a review from mkaz as a code owner January 23, 2021 23:17
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jan 23, 2021
#28340)

Original issue was that when adding Social Icons to a Navigation block, the icons would be oblong instead of circle. The icons only misshapened when size Small or Normal was selected. I also noticed that when a horizontal Nav block was added, the social icons wouldn't align horizontally, and in a vertical Nav block, the social icons wouldn't align vertically.
@talldan talldan added [Block] Navigation Affects the Navigation Block [Block] Social Affects the Social Block - used to display Social Media accounts [Type] Bug An existing feature does not function as intended labels Feb 2, 2021
@talldan talldan linked an issue Feb 2, 2021 that may be closed by this pull request
@jasmussen
Copy link
Contributor

Thank you for the PR! This is nice work! It does indeed fix the issue:

Screenshot 2021-02-02 at 10 23 44

Using fit-content to avoid the oblong shape is also clever. However it makes me a bit nervous about adding that particular property, as in the past it has caused unforeseen consequences with regards to empty containers and such.

I dove in to look at the issue, and it appears primarily to be because the Navigation block is a flex container, which means the margin that's attached to each social link defines the shape:

.wp-block-social-links .wp-social-link.wp-social-link.wp-social-link {
    margin: 4px 8px 4px 0;
}

In flex containers, the auto keyword can be used to center items. And sure enough, if I do the following, it also works:

.wp-block-social-links .wp-social-link.wp-social-link.wp-social-link {
    margin: auto 8px auto 0;
}

Screenshot 2021-02-02 at 10 22 26

The benefit to using the auto margin is that it will always be vertically centered in the navigation menu, regardless of how tall the navigation menu is.

What do you think?

@Arash-11
Copy link
Contributor Author

Arash-11 commented Feb 2, 2021

Seeing your solution, I think using margin in this fashion is the best way to address this issue; this is so much more elegant.

I'll remove align-items: center and height: fit-content and instead add what you suggested. Thank you!

@jasmussen
Copy link
Contributor

Congrats on your first PR! Going to merge this one for you.

@jasmussen jasmussen merged commit 35d92db into WordPress:master Feb 3, 2021
@github-actions
Copy link

github-actions bot commented Feb 3, 2021

Congratulations on your first merged pull request, @Arash-11! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 10.0 milestone Feb 3, 2021
@Arash-11
Copy link
Contributor Author

Arash-11 commented Feb 3, 2021

Thank you for helping a newbie like me and I'm happy I got an opportunity to work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Block] Social Affects the Social Block - used to display Social Media accounts First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Social block icons misshapen when used in navigation block
4 participants