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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scss/atoms/typography/_functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
* 1. font-size: em(14px);
* 2. font-size: em(30px/14px);
*/
@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.

}
2 changes: 1 addition & 1 deletion scss/atoms/typography/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ==========================================================================
*/
@mixin heading($style) {
font-size: em(map-get($style,font-size));
font-size: rem(map-get($style,font-size));
font-weight: map-get($style,font-weight);
line-height: 1;
text-transform: map-get($style,capitalization);
Expand Down
4 changes: 2 additions & 2 deletions scss/atoms/typography/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ strong {

code {
background: map-get($typography-code,background);
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.

border-radius: map-get($typography-code,border-radius);
}