-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Typography [fixes #763] #801
Conversation
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.
Hmmm this looks super neat! I do wish we had chatted through this approach before going this route though. My gut reaction is that I don't love this approach but I'm open to hearing out why you decided to go this direction. What are the advantages you see in this T.vue
component + tailwinds style vs. just editing the existing global styles in theme.styl?
My primary concern is that it may create an intimidating codebase that will require a learning curve for most developers looking to contribute. E.g. I suspect a component like <T p l4 cText s300 class="subtitle mw55ch">
will be difficult to understand at first glance for most developers who are not already familiar with the codebase.
When considering tradeoffs, I'd like us to optimize our codebase for ease of contributions. I want to ensure we lower the friction as much as possible for anyone looking to hop in & e.g. complete a Gitcoin bounty.
@samajammin I totally understand where you're coming from, it is a lot to get to grips with initially. But imo this has a number of benefits, mainly: No inheritance
I think a reason it looks intimidating is the chain of High visibility & works according constraints Now there is definitely a downside with atomic classes:
The naming could be much clearer, but it is a 1:1 representation of the Figma file, allowing people to leverage the exact colours and type sizes (and max-widths) without having to apply create any extra classes. In most pages, like It's a little extra work, but I think all of this could be documented very easily — I could fork the repo to have a single page which shows |
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.
Solid progress here. Discussed this offline with @carlfairclough but circling back here - let's keep the utility classes but remove the T.vue component in favor of just rendering elements directly & using classnames instead of passing props. So instead of:
<T p l4 cText s300 class="subtitle mw55ch">
We'll do:
<p class="subtitle mw55ch l4 c-text s300">
This will make code clearer for contributors & remove the risk of developer error e.g. by passing in an invalid element to the T.vue component.
The styles in T.vue we can just move over to theme.styl or utils.styl or whever you think makes the most sense.
Thanks!
All issues have been addressed, however some fairly significant changes have been introduced, the most major structurally, HTML/CSS wise, around handling content blocks within markdown. Anchors & headers
These have been removed — I previously thought they made sense given they are accessible via the sidebar.
The targets now have pseudo-elements which prevent them from being hidden behind the nav when automatically scrolled to:
This brought in a secondary issue, where the sidebar links would ignore the new pseudo-target. I have addressed the issue, however it involved an update to how the sidebar links work — instead of using
Updated this so it can breathe. We should also update figma to reflect the change .md content column
Currently, a max-width/width is defined on the content column, with components being called inside that (which is the case inside the languages page). To avoid md components from being constrained this way, a T.vueGone! But the utility classes are now heavily used Utility class generationThere is a helper function to avoid repetitive class creation, it can be used in either of the following ways:
|
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.
Style changes look awesome for the most part but the component refactors to use data
& template loops introduced some bugs. It will be fastest to hop on a call & talk through this.
I think the takeaway here is to move towards smaller, more iterative PRs, e.g. creating a standalone PR that refactors the components to use data
& loops (& test that works across languages) vs. bundling those into these style changes.
@@ -277,5 +145,78 @@ table | |||
border 1px dotted $colorPrimary | |||
box-shadow 0 4px 8px $boxShadowHoverColor | |||
|
|||
// BASE TEXT STYLES | |||
// These target mainly our markdown content, and whenever a .l# class is not used | |||
// They should eventually be moved out of utils.styl |
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.
Do you mean moved into utils.styl?
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.
// They should eventually be moved out of utils.styl | ||
|
||
h1, h2, h3, h4, h5, h6, p, span, li { | ||
max-width: $contentWidth; |
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.
Thoughts @carlfairclough?
|
||
// Set text colors | ||
// these should be revisited | ||
// alongside colors in config.vue |
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.
Ya shouldn't we use the variables from config.styl here? e.g. $colorPrimaryDark800
instead of mix($colorBlack, $colorPrimaryDark, 60%)
again?
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.
Thoughts @carlfairclough ?
Homepage is still broken for some translations, e.g. https://deploy-preview-801--ethereumorg.netlify.com/se/ |
Homepage highlight is broken for right to left languages, e.g. https://deploy-preview-801--ethereumorg.netlify.com/ar/ |
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 work! I'm going to merge this to keep us moving forward. I will make some fixes in a pending PR. I also made a couple requests for updates / comments - please incorporate those into future PRs.
Updated all typography
Description
Moved almost all typography rules to live in
T.vue
which can either be called with<T props />
or with classes (unscoped). It follows tailwind/tachyons/atomic/etc style css rules with low levels of specificity. This is a highly rigid approach but enables us to ensure that type goes through a single funnel, and minimizes custom styles.Default type color classes have been defined which will switch on darkmode without having to redefine them.
Markdown content is styled with a chain of
:not()
s which prevent the styles from overriding any explicitly set. For example,<div class="featured" />
has been replaced in markdown with themarkdown-it-attrs
package, allowing you to pass something such as# Lorem ipsum si dolor et amet {.l3}
, which will create a h1 element withlevel 3
styles applied. By default,h1
useslevel 1``.l1
Some pages with repeated content now use
v-for
and and object array indata:
to allow styles for the content blocks to be defined once./build/
is the most significant example of this.Related Issue
#763