// Calculate width // ------------------------------------------------------------------------------- // @dependence `get-value()` // @dependence `fluid-width()` // ------------------------------------------------------------------------------- // @param $key [Breakpoint | "container"] : how to calculate value // @param $span [Value] : span // @param $context [Value] : if context is needed // ------------------------------------------------------------------------------- // @return [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; } }