-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Increase author link visibility & link avatars in blog posts + previews #5813
Conversation
…iews Increase author link visibility and link avatar - `www/src/components/blog-post-preview-item.js` - `www/src/templates/template-blog-post.js` Ref #3199 #4354 #5396 Confirmed addition of `transform: translateZ(0)` in blog-post-preview-item.js prevents image twitch in Chrome when hovering the card, way to go @fk
Deploy preview for using-drupal ready! Built with commit 980aea5 |
Deploy preview for gatsbygram ready! Built with commit 980aea5 |
@KyleAMathews @fk this contains design changes if you wanna take a look |
Preview of changes: https://deploy-preview-5813--gatsbyjs.netlify.com/blog/ |
Hey @rdela! Thanks for sticking with us! 🤗 |
@fk doesn't look like your comments got posted? |
boxShadow: `none !important`, | ||
borderBottom: `0 !important`, | ||
color: `${colors.gatsby} !important`, | ||
fontSize: `102%`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to increase font-size here because we don't mix Futura with Spectral.
position: `relative`, | ||
zIndex: 1, | ||
"&&": { | ||
fontWeight: `normal`, | ||
fontWeight: `bold`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mirrored these requested changes to the preview on post as well, thinking we would want agreement, but I split them into 2 commits so it would be easy to revert if you liked the bold in the post view. I will add a screenshot comparison in a sec.
@KyleAMathews Argh, wrong textarea. :D Thank you! |
Thanks @pieh @fk @KyleAMathews. Looked like it was having build issues on Netlify at first after I pushed these commits, Here is the screenshot comparison of Thinking same concern about taking away from the blog post title would apply here too and that we would want agreement between post and preview. I split preview and post changes into 2 commits so it would be easy to revert post one and just get rid of [Edit 1]: Top half of image and deploy preview Side note: while I was puzzling over build issues I had some housekeeping ideas about maybe updating On my blog I also have "--no-ignore-optional" in Setting
Probably worth opening a new issue with a title like |
to={post.frontmatter.author.fields.slug} | ||
css={{ | ||
boxShadow: `none !important`, | ||
borderBottom: `0 !important`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move the keys (here and also the ones below) that require !important
to the &&
selector which glamor offers to increase specifity (ref. https://github.com/threepointone/glamor/blob/master/docs/selectors.md).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like I should do the same here then?
https://github.com/gatsbyjs/gatsby/pull/5813/files/b9c097e3eba19af0a824098aefe1e812ed00125b#diff-3f9ee2e9c0e318b6189a8f786092c9f5R164
template-blog-post.js
L164
color: `${colors.gatsby} !important`,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and committed a change with suggestion above. Changed my mind about the last comment though, and maybe the commit. Color me puzzled. Perhaps I am not understanding Glamor but I do not see how given HTML like
<a class="css-9rkwk9" href="/contributors/michelle-barker/">Michelle Barker</a>
the resulting CSS:
.css-9rkwk9.css-9rkwk9, [data-css-9rkwk9][data-css-9rkwk9] {
color: #663399 !important;
font-weight: normal;
}
is more specific than
.css-9rkwk9,[data-css-9rkwk9]{
position:relative;
z-index:1;
}
.css-9rkwk9.css-9rkwk9
seems redundant to me. If it is I can revert the last commit. If it makes sense to you then this is ready unless you want me to wrap
color: `${colors.gatsby} !important`,
in an &&
section in template-blog-post.js
as well per above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The chained selectors (e.g. .css-9rkwk9.css-9rkwk9
) are what is actually doing the trick. To quote the genius named Harry Roberts (@csswizardry):
[…] you can chain a selector with itself to increase its specificity.
(via https://csswizardry.com/2014/07/hacks-for-dealing-with-specificity/#safely-increasing-specificity)
Also see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what about previous comment then?
Seems like I should do the same here then?
https://github.com/gatsbyjs/gatsby/pull/5813/files/b9c097e3eba19af0a824098aefe1e812ed00125b#diff-3f9ee2e9c0e318b6189a8f786092c9f5R164
template-blog-post.js
L164
(add &&
selector to template-blog-post.js
and move color: `${colors.gatsby} !important`,
to it?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally we should avoid (and have avoided—I'm quite sure I'm guilty here as I wasn't aware of &&
when I first started using Glamor ;-)) using !important
(see e.g. https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity#The_!important_exception).
If you need to override styles try if Glamor's &&
will do and make !important
a last resort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lookin' good! thank you @rdela!
...which glamor offers to increase specifity (ref. https://github.com/threepointone/glamor/blob/master/docs/selectors.md) via @fk review `src/components/blog-post-preview-item.js`
Left some comments in the (now outdated) review regarding specificity and the last commit: whether it should be reverted, or whether same concept (add |
👋 @rdela Just left a comment that should clarify things! |
@fk Thanks, not sure I understand after looking through all that unless the goal is to remove From CSS Wizardry article:
Specificity-wise
Also note the:
on Mathias’ slide. All that said, whether or not you want to get rid of |
Yep!
Yes; in this particular case I think we don't need either (see comment in code). |
Conflicts: www/src/templates/template-blog-post.js L 137 `fixed={post.frontmatter.author.avatar.childImageSharp.fixed}` * upstream/master: (651 commits) chore(release): Publish [www] Gatsby/rebeccapurple banner (#6161) delay page transition until we have all resources (#6158) Fix old query results showing up in develop (#6159) Tidy up the remark example (#6160) fix displaying of graphql resolver errors (#6142) Move store assignment out of component. (#6150) [v2] Fix doc not centered (#6146) chore(release): Publish [gatsby-source-contentful] pass host to client init (#6149) [v2] migrate gatsby-plugin-feed to use new Link (#6147) Make getElementById Conditional (#6145) chore(release): Publish update yarn.lock Update plugins.md (#6099) add gatsby-starter-skeleton (#6141) [gatsby-source-mongodb] added support for extra connection string params (#5972) create public page renderer and export correct version (dev / prod) depending on NODE_ENV (#5986) Treat integers longer than 32 bit as floats. (#6082) Export graphql TypeScript definition from gatsby package (#6096) ...
@fk Given #6076 / #6153 and that I already had a conflict that required updating figured I would target Ran Prettier and got rid of all use of |
Preview of changes: https://deploy-preview-5813--next-gatsbyjs.netlify.com/blog/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thank you @rdela!
Thanks @rdela! This will go live on next.gatsbyjs.org for now, then gatsbyjs.org once v2 is released. |
Increase author link visibility and link avatar
www/src/components/blog-post-preview-item.js
www/src/templates/template-blog-post.js
Ref #3199 #4354 #5396
Confirmed addition of
transform: translateZ(0)
in
blog-post-preview-item.js
prevents image twitch in Chrome when hovering the card, way to go @fk