Created
February 5, 2018 02:12
-
-
Save t-laird/d767d69969a9b80a3230d0dc24a5557d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//from GitPoint's fontsize helper https://github.com/gitpoint/git-point/blob/master/src/config/normalize-text.js | |
export const normalize = size => { | |
if (pixelRatio === 2) { | |
if (deviceWidth < 360) { | |
return size * 0.95; | |
} | |
if (deviceHeight < 667) { | |
return size; | |
} else if (deviceHeight >= 667 && deviceHeight <= 735) { | |
return size * 1.15; | |
} | |
return size * 1.25; | |
} | |
if (pixelRatio === 3) { | |
if (deviceWidth <= 360) { | |
return size; | |
} | |
if (deviceHeight < 667) { | |
return size * 1.15; | |
} | |
if (deviceHeight >= 667 && deviceHeight <= 735) { | |
return size * 1.2; | |
} | |
return size * 1.27; | |
} | |
if (pixelRatio === 3.5) { | |
if (deviceWidth <= 360) { | |
return size; | |
} | |
if (deviceHeight < 667) { | |
return size * 1.2; | |
} | |
if (deviceHeight >= 667 && deviceHeight <= 735) { | |
return size * 1.25; | |
} | |
return size * 1.4; | |
} | |
return size; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment