Sha256: 9409e949c2651a4969ffd3f31f50053cf23f3c55aaef595fcdce83538dd83e8e

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

// Calculate width
// -------------------------------------------------------------------------------
// @dependence `get-value()`
// @dependence `fluid-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 calc-width($key, $span, $context: null) {
	@if get-value("settings", "grid") == "fluid" {

		@if $key == "container" or $span == "container" {

			@return fluid-width(get-value($key, "breakpoint"), get-value($key, "breakpoint"));

		} @else if $context == null {

			@return fluid-width((get-value($key, "breakpoint") / get-value($key, "columns") * $span), get-value($key, "breakpoint"));

		} @else {

			@return fluid-width((get-value($key, "breakpoint") / get-value($key, "columns") * $span), ((get-value($key, "breakpoint") / get-value($key, "columns") * $context)));

		}

	} @if get-value("settings", "grid") == "fixed" {

		@if $key == "container" or $span == "container" {

			@return get-value($key, "breakpoint");

		} @else {

			@return get-value($key, "breakpoint") / get-value($key, "columns") * $span;

		}

	} @else {
		@return false;
	}
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flint-gs-1.6.2 stylesheets/flint/functions/lib/_calc-width.scss
flint-gs-1.6.0 stylesheets/flint/functions/lib/_calc-width.scss
flint-gs-1.5.0 stylesheets/flint/functions/lib/_calc-width.scss