Sha256: c5d74d6711200cefc482593ea77d381449dbba20c4e7afc2958fc70279fb449d

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

// Augments a breakpoint map by building a "scale" property
// containing the specified sizes to each breakpoint.

@function ss-make-responsive-font-scale(
	$breakpoints: (
		// Phone sizes
		"default": (
			"base-font-size": 18px,
			"base-line-height": 1.5,
			"max-font-size": 28px,
			"max-line-height": 1.35,
			"rounding": false
		),
		// Tablet sizes and larger
		"tablet": (
			"media-query": "screen and (min-width: 600px)",
			"base-font-size": 20px,
			"base-line-height": 1.6,
			"max-font-size": 42px,
			"max-line-height": 1.25,
			"rounding": false
		)
	),
	$numb-smaller-sizes: 1,
	$numb-larger-sizes: 4
) {

	$sane-scale: ();

	// Create a scale for each breakpoint.
	@each $breakpoint-name, $breakpoint-value in $breakpoints {

		// Create a font scale.
		$scale: ss-make-font-scale(
			map-get($breakpoint-value, "base-font-size"),
			map-get($breakpoint-value, "base-line-height"),
			map-get($breakpoint-value, "max-font-size"),
			map-get($breakpoint-value, "max-line-height"), 
			$numb-smaller-sizes,
			$numb-larger-sizes,
			map-get($breakpoint-value, "rounded")
		);

		// Merge into responsive scale.
		$new-breakpoint-value: map-merge($breakpoint-value, ("scale": $scale));
		$sane-scale: map-merge($sane-scale, ($breakpoint-name: $new-breakpoint-value));
	}

	@return $sane-scale;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sane-scale-0.1.2 stylesheets/sane-scale/_make-responsive-font-scale.scss
sane-scale-0.1.1 stylesheets/sane-scale/_make-responsive-font-scale.scss
sane-scale-0.1 stylesheets/sane-scale/_make-responsive-font-scale.scss