Sha256: 9ddbd274c80e77d39e32a7a98c0832f8dcb82593f0bbf1df651b3a6189eab595

Contents?: true

Size: 1.71 KB

Versions: 5

Compression:

Stored size: 1.71 KB

Contents

// Calculate width
// -------------------------------------------------------------------------------
// @param $key [string] : key for lookup
// @param $span [number] : span value of element
// @param $context [number] : context value of element
// -------------------------------------------------------------------------------
// @return calculated value | false

@function flint-calc-width($key, $span, $context: null) {
	$result: false;

	// Check to see if value has been cached
	@if map-has-key($flint__cached-values, "#{$key, $span, $context}::width") and $context != "auto" {
		@return map-get($flint__cached-values, "#{$key, $span, $context}::width");
	}

	@if flint-get-value("settings", "grid") == "fluid" {
		@if $key == "container" or $span == "container" {

			$result: flint-fluid-width(flint-get-value($key, "breakpoint"), flint-get-value($key, "breakpoint"));

		} @else if $context == null {

			$result: flint-fluid-width((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span), flint-get-value($key, "breakpoint"));

		} @else {

			$result: flint-fluid-width((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span), ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));

		}
	} @if flint-get-value("settings", "grid") == "fixed" {
		@if $key == "container" or $span == "container" {

			$result: flint-get-value($key, "breakpoint");

		} @else {

			$result: flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span;

		}
	}

	// Save result to cache
	@if $context != "auto" {
		$flint__cached-values: map-merge($flint__cached-values, ("#{$key, $span, $context}::width": $result));
	}

	// Return result
	@return $result;
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flint-gs-1.10.0 stylesheets/flint/functions/lib/_calc-width.scss
flint-gs-1.9.1 stylesheets/flint/functions/lib/_calc-width.scss
flint-gs-1.8.0 stylesheets/flint/functions/lib/_calc-width.scss
flint-gs-1.7.2 stylesheets/flint/functions/lib/_calc-width.scss
flint-gs-1.7.0 stylesheets/flint/functions/lib/_calc-width.scss