-
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
37f7bab
Increase author link visibility and link avatars in blog posts + prev…
rdela 3aad32e
lose font-size increase and bold
rdela b9c097e
lose font-size increase and bold for post too
rdela c495ea7
move keys that require !important to the && selector
rdela 8508952
Merge remote-tracking branch 'upstream/master' into author-link-styles
rdela 980aea5
remove !important from blog preview and post layout
rdela File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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
the resulting CSS:
is more specific than
.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 wrapin an
&&
section intemplate-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):(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?
(add
&&
selector totemplate-blog-post.js
and movecolor: `${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.
L164 seems to work fine without the
!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.
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.