Sha256: 433c0f4b36ae8081a41c35d55ec196077b284b3ab1046b45aa25635eae3d016d

Contents?: true

Size: 1.71 KB

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
flint-gs-1.12.0 stylesheets/flint/functions/lib/_calc-width.scss
flint-gs-1.11.2 stylesheets/flint/functions/lib/_calc-width.scss