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

Add blankslate classes to replace utilities #1919

Merged
merged 2 commits into from
Feb 1, 2022

Conversation

hectahertz
Copy link
Contributor

@hectahertz hectahertz commented Feb 1, 2022

What are you trying to accomplish?

This is part of the effort to remove all usages of utility classes to improve consistency and prevent specificity bugs. There will be a follow up PR on primer/view_components to use these on Blankslate. More context on https://github.com/github/primer/issues/585.

There's a couple minor spacing issues that have been addressed too. They had been pointed out on (the component audit)[https://github.com/github/primer/issues/373#issuecomment-943927091].

Before

Before

After

After

  • The description paragraph bottom margin was not collapsing with the button top margin because margins on button don't collapse. As we use div wrappers for actions now, this works and we have standard spacing.
  • The second action was using a p as a way to get display: block and a bottom margin. As we use div wrappers for actions now, this is also simplified and we can use a standard margin.

What approach did you choose and why?

I decided to go for a minimally invasive set of changes so we can make these changes in all components with the least amount of friction possible. No breaking changes.

I found a couple inconsistencies that I'd like to mention.

Heading font size

As per the discussions on this issue it seems that we don't want to default to any size and keep the default heading styling. cc @pouretrebelle @ashygee

The Blankslate view component adds a h2 utility class by default but, because we want to remove this behavior, I won't add it to blankslate-heading and will remove it on the primer/view_components PR.

Default heading tag

In the primer/css docs we default to h3 everywhere, but this doesn't match primer/view_components where we use h2 in 99% of the cases. We might want to update the examples to keep things more consistent.

What should reviewers focus on?

Please focus on the explanations on the previous point.

Are additional changes needed?

  • No, this PR should be ok to ship as is. 🚢

@hectahertz hectahertz requested a review from a team as a code owner February 1, 2022 16:28
@changeset-bot
Copy link

changeset-bot bot commented Feb 1, 2022

🦋 Changeset detected

Latest commit: 4fe418c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/css Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This is part of the effort to remove all usages of utility classes to
improve consistency and prevent specificity bugs.
@@ -27,22 +27,26 @@ When it helps the message, include (relevant) icons in your blank slate. Add the
<div class="blankslate">
<!-- <%= octicon "octoface", :height = 24, :class => "blankslate-icon" %> -->
<svg class="octicon octicon-octoface blankslate-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M7.75 11c-.69 0-1.25.56-1.25 1.25v1.5a1.25 1.25 0 102.5 0v-1.5C9 11.56 8.44 11 7.75 11zm1.27 4.5a.469.469 0 01.48-.5h5a.47.47 0 01.48.5c-.116 1.316-.759 2.5-2.98 2.5s-2.864-1.184-2.98-2.5zm7.23-4.5c-.69 0-1.25.56-1.25 1.25v1.5a1.25 1.25 0 102.5 0v-1.5c0-.69-.56-1.25-1.25-1.25z"></path><path fill-rule="evenodd" d="M21.255 3.82a1.725 1.725 0 00-2.141-1.195c-.557.16-1.406.44-2.264.866-.78.386-1.647.93-2.293 1.677A18.442 18.442 0 0012 5c-.93 0-1.784.059-2.569.17-.645-.74-1.505-1.28-2.28-1.664a13.876 13.876 0 00-2.265-.866 1.725 1.725 0 00-2.141 1.196 23.645 23.645 0 00-.69 3.292c-.125.97-.191 2.07-.066 3.112C1.254 11.882 1 13.734 1 15.527 1 19.915 3.13 23 12 23c8.87 0 11-3.053 11-7.473 0-1.794-.255-3.647-.99-5.29.127-1.046.06-2.15-.066-3.125a23.652 23.652 0 00-.689-3.292zM20.5 14c.5 3.5-1.5 6.5-8.5 6.5s-9-3-8.5-6.5c.583-4 3-6 8.5-6s7.928 2 8.5 6z"></path></svg>
<h3>This is a blank slate</h3>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was missing the heading margin

Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 👍🏻

@jonrohan jonrohan enabled auto-merge (squash) February 1, 2022 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants