Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Typography: change the unit measurement from 'em' to 'rem' #174

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lunaticmonk
Copy link

I tried to refactor the code and changed the em converter to rem since it would be better to use rem. em would cause problems when 2-3 elements are nested. Opinions?

@geekman-rohit
Copy link
Contributor

@sumedh123 just changing the unit will not suffice in our case. It's not so much change the unit that we wish to do, but change the approach entirely. This will most probably mean a major code change and a change/removal of the em mixin we are using

@function em($value, $context: map-get($typography-font-default, font-size)) {
@return ($value / $context * 1em);
@function rem($value, $context: map-get($typography-font-default, font-size)) {
@return ($value / $context * 1rem);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should reconsider this approach of deciding in pixels and then converting to ems/rems. It should be the other way round, deciding a scale then converting it to pixels(only if necessary). I'll bring it up in next meeting. We can keep the PR pending until then.

font-size: em( 16px );
padding: em( 4px, 16px ) em( 8px, 16px );
font-size: rem( 16px );
padding: rem( 4px, 16px ) rem( 8px, 16px );
Copy link
Contributor

Choose a reason for hiding this comment

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

Padding should probably be em not rem. Again a point we can discuss during next meeting. Padding is meant to be space between border and text to make text look better and readable, it makes sense to decide padding in scale of current element font size rather than root element font size.

@geekman-rohit
Copy link
Contributor

geekman-rohit commented Feb 15, 2017

The changes I requested all need discussion, but they need to be discussed before we merge any more PRs

Base automatically changed from master to main March 16, 2021 16:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants