Skip to content
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

Adding SCSS Support #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
32 changes: 32 additions & 0 deletions mixin.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@function bk-calculateTypeOffset($line-height, $font-size, $descdender-height-scale){
Copy link
Owner

Choose a reason for hiding this comment

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

You have a typo here, should be $descender-height-scale

$line-height-scale: $line-height / $font-size;
$line-height-scale: (($line-height-scale - 1) / 2) + $descdender-height-scale;
Copy link
Owner

Choose a reason for hiding this comment

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

Rather than mutate the $line-height-scale variable here, you can just return this line right?

@return $line-height-scale;
}

@mixin bk-render($font-size, $line-height, $type-offset){
font-size: $font-size * 1px;
line-height: $line-height * 1px;
transform: translateY( $type-offset * 1em );
}
Copy link
Owner

Choose a reason for hiding this comment

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

My SASS experience is non-existent so excuse my ignorance, but any reason you dont place these functions inside the basekick mixin? Are they global when they sit out here?


@mixin basekick(
$bk-type-size-modifier,
$bk-type-row-span,
$bk-descender-height-scale,
$bk-base-font-size,
$bk-grid-row-height,
$bk-line-height-override: false){

$font-size: $bk-type-size-modifier * $bk-base-font-size;

@if type-of($bk-line-height-override) == number {
$line-height: $bk-line-height-override;
$type-offset: bk-calculateTypeOffset($line-height, $font-size, $bk-descender-height-scale);
@include bk-render($font-size, $line-height, $type-offset);
} @else {
$line-height: $bk-grid-row-height * $bk-type-row-span;
$type-offset: bk-calculateTypeOffset($line-height, $font-size, $bk-descender-height-scale);
@include bk-render($font-size, $line-height, $type-offset);
}
Copy link
Owner

Choose a reason for hiding this comment

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

I would propose cleaning up some of this duplication by using a more ternary like syntax for the line-height/line-height-override:

$line-height: if(type-of($bk-line-height-override) == number,
  $bk-line-height-override,
  $bk-grid-row-height * $bk-type-row-span);

Then you would not need to duplicate the $type-offset calculation, and could arguably do away with the bk-render mixin and just have the properties inline.

}