-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcc3ffc
commit 8b52d70
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Fluid type that increase font size smoothly and linearly between a min and max value | ||
* over the viewport width range 360px (XS) to 1500px (2XL) | ||
* See concept on https://www.aleksandrhovhannisyan.com/blog/fluid-type-scale-with-css-clamp/ | ||
* Good for use in hero banners and horizontal cards where UI looks better with a smooth transition of font size | ||
* Here we offer the sizes from fluid-type-4 to fluid-type-10. Their min and max values at the XS and 2XL breakpoints | ||
* are the same as the corresponding modular typography classes (type-4 to type-10). | ||
*/ | ||
module.exports = function () { | ||
return function ({ addComponents }) { | ||
const components = { | ||
'.fluid-type-4': { | ||
fontSize: 'clamp(3.1rem, 2.19vw + 2.31rem, 5.6rem)', | ||
}, | ||
'.fluid-type-5': { | ||
fontSize: 'clamp(3.6rem, 2.98vw + 2.53rem, 7rem)', | ||
}, | ||
'.fluid-type-6': { | ||
fontSize: 'clamp(4.2rem, 4.04vw + 2.75rem, 8.8rem)', | ||
}, | ||
'.fluid-type-7': { | ||
fontSize: 'clamp(4.8rem, 5.44vw + 2.84rem, 11rem)', | ||
}, | ||
'.fluid-type-8': { | ||
fontSize: 'clamp(5.5rem, 7.19vw + 2.91rem, 13.7rem)', | ||
}, | ||
'.fluid-type-9': { | ||
fontSize: 'clamp(6.3rem, 9.47vw + 2.89rem, 17.1rem)', | ||
}, | ||
'.fluid-type-10': { | ||
fontSize: 'clamp(7.3rem, 12.37vw + 2.85rem, 21.4rem)', | ||
}, | ||
}; | ||
|
||
addComponents(components); | ||
}; | ||
}; |
This file contains 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
This file contains 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