HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/boomdekwekerij.komma.nl/resources/sass/2-Tools/_tools.toolbox.scss
/* =============================================
   Toolbox functions
   ================================================ */


/**
 *  Maths helpers.
 *  Halve and double numbers, returning rounded integers.

    USAGE:

    .foo {
        padding: halve(30px);
    }

 */

@function quarter($number) {
	@return round($number / 4);
}

@function halve($number) {
	@return round($number / 2);
}

@function double($number) {
	@return round($number * 2);
}

@function triple($number) {
	@return round($number * 3);
}

@function quadruple($number) {
	@return round($number * 4);
}


/**
 *  Remove the unit of a length
 *  @param {Number} $number - Number to remove unit from
 *  @return {Number} - Unitless number
 */

@function strip-unit($number) {
	@if type-of($number) == 'number' and not unitless($number) {
		@return $number / ($number * 0 + 1);
	}

	@return $number;
}


/* Check if value is number */

@function is-number($value) {
	@return type-of($value) == 'number';
}


/* Value to Em */

@function valueToRem($value) {
	$noUnits: strip-unit($value);
	@return #{$noUnits / 16 * 1rem};
}

/* Value to Rem */

@function valueToEm($value) {
	$noUnits: strip-unit($value);
	@return #{$noUnits / 16 * 1em};
}




// Set a fixed space based on the 8pt grid
// Just pass the function a number equal to the number of (8)points you need
@function space($size: '1') {
  @return 8px * $size;
}



/*
 * Set vertical spacing only for mobile viewport

 USAGE:

 .example {
	 @include vspacing-s(
				'margin-top' 1
		);
  }

 */



@mixin vspacing-s($values...) {
  @include mq($max: m) {
    @each $i in $values {
      // By setting gutter size as a halve column width we can make 'squares' on mobile
      #{nth($i, 1)}: #{($site-gutter-width * 2) * nth($i, 2)};
    }
  }
}

/*
 * Set vertical spacing for viewport larger than mobile
 * In flexible units (vw) and on max viewport in a fixed amount (px)

 USAGE:

 .example {
	 @include vspacing-m-up(
				'padding-top' 0.33,
				'margin-bottom' 0.5
		);
  }

 */

@mixin vspacing-m-up($values...) {
  @include mq(m, l) {
    @each $i in $values {
      #{nth($i, 1)}: #{(1 / ($site-columns-m + 2) * 100) * nth($i, 2)}vw;
    }
  }
  @include mq(l, $bp-max) {
    @each $i in $values {
      #{nth($i, 1)}: #{(1 / ($site-columns-l + 2) * 100) * nth($i, 2)}vw;
    }
  }
  @include mq($bp-max) {
    @each $i in $values {
      #{nth($i, 1)}: #{($site-max-width / $site-columns-l) * nth($i, 2)}px;
    }
  }
}

/*
 * From values given return the correct v-spacing for each breakpoint
 */
@mixin vspacing($values...) {
	@include vspacing-s($values...);
	@include vspacing-m-up($values...);
}


/**
 *	A simple function for setting a consistent border-radius

	USAGE:

	.card {
		@include border-radius;
	}

	.card--alt {
		@include border-radius(l);
	}

 */
@mixin border-radius($type: s) {
	@if ($type == 's') {
		border-radius: map-get($border-radius, s);
	}
	@if ($type == 'm') {
		border-radius: map-get($border-radius, m);
	}
	@if ($type == 'l') {
		border-radius: map-get($border-radius, l);
	}
}

/**
 * Lobotomized Owl Selector mixin:
 * - Set spacing for consecutive items with margin-top on all but the first item

	USAGE:

	.box {
		@include owl-children;
	}

	.card__item {
		@include owl;
	}

 */

/*
 * Lobotomized owl selector.
 * - Gives the children of the element spacing
 * - https://alistapart.com/article/axiomatic-css-and-lobotomized-owls
 */
@mixin owl-children($margin: #{$line-height-ratio}rem) {
	& > * + * {
		margin-top: $margin;
	}
}

// Gives the element itself spacing
@mixin owl($margin: #{$line-height-ratio}rem) {
	& + & {
		margin-top: $margin;
	}
}

/**
 *  Show hyphens for every browser supporting it
 *  and will break lines in every other browser
 */

@mixin hyphenate {
	overflow-wrap: break-word;
	word-wrap: break-word;
	-webkit-hyphens: auto;
	-ms-hyphens: auto;
	hyphens: auto;
}


// when hover or active disable outline styling
@mixin disableOutlineForMouse {
	&:hover,
	&:active {
		outline: none !important;
	}
}



/*
 *  Restrict an element to a max-width for creating gutters on the side
 */

@mixin contain($onMedium: true) {
	width: calc(100% - #{double($site-gutter-width)}); // Making sure it doesn’t get to small with little content
	margin-left: auto;
	margin-right: auto;

	@include mq(m) {
		@if($onMedium == true) {
				width: calc((100% / #{$site-columns-m + 2}) * #{$site-columns-m});
    } @else {
			width: 100%;
		}
  }

	@include mq(l) {
		width: calc((100% / #{$site-columns-l + 2}) * #{$site-columns-l});
		max-width: #{$site-max-width}px;
	}
}


@mixin gutterPadding($mq){
	$columnCount: $site-columns-s;

	@if($mq == m) { $columnCount: $site-columns-m; }
	@if($mq == l) { $columnCount: $site-columns-l; }

	@include mq($mq) {
		padding-left: percentage(1 / ($columnCount + 2));
		padding-right: percentage(1 / ($columnCount + 2));
	}
}


/*
 *	A mixin to set elements to its own named grid-area
 */

@mixin template($elements...) {
	@each $element in $elements {
		&__#{$element} {
			grid-area: $element;
			display: block; // In IE grid items can't be inline
		}
	}
}