
// ==========================================================================
// Breakpoint Mixin
// This has been deprecated. New breakpoints should be created using Gutenberg breakpoints:
// https://github.com/WordPress/gutenberg/blob/0f1f5e75408705f0ec014f5d2ea3d9fcc8a97817/packages/base-styles/_mixins.scss
//
// See https://wpcalypso.wordpress.com/devdocs/docs/coding-guidelines/css.md#media-queries
// ==========================================================================

$breakpoints: 480px, 660px, 800px, 960px, 1040px, 1280px, 1400px; // Think very carefully before adding a new breakpoint

@mixin breakpoint-deprecated( $sizes... ) {
	@each $size in $sizes {
		@if type-of( $size ) == string {
			$approved-value: 0;
			@each $breakpoint in $breakpoints {
				$and-larger: ">" + $breakpoint;
				$and-smaller: "<" + $breakpoint;

				@if $size == $and-smaller {
					$approved-value: 1;
					@media (max-width: $breakpoint) {
						@content;
					}
				} @else {
					@if $size == $and-larger {
						$approved-value: 2;
						@media (min-width: $breakpoint + 1) {
							@content;
						}
					} @else {
						@each $breakpoint-end in $breakpoints {
							$range: $breakpoint + "-" + $breakpoint-end;
							@if $size == $range {
								$approved-value: 3;
								@media (min-width: $breakpoint + 1) and (max-width: $breakpoint-end) {
									@content;
								}
							}
						}
					}
				}
			}
			@if $approved-value == 0 {
				$sizes: "";
				@each $breakpoint in $breakpoints {
					$sizes: $sizes + " " + $breakpoint;
				}
				// TODO - change this to use @error, when it is supported by node-sass
				@warn "ERROR in breakpoint-deprecated( #{ $size } ): You can only use these sizes[ #{$sizes} ] using the following syntax [ <#{ nth( $breakpoints, 1 ) } >#{ nth( $breakpoints, 1 ) } #{ nth( $breakpoints, 1 ) }-#{ nth( $breakpoints, 2 ) } ]";
			}
		} @else {
			$sizes: "";
			@each $breakpoint in $breakpoints {
				$sizes: $sizes + " " + $breakpoint;
			}
			// TODO - change this to use @error, when it is supported by node-sass
			@warn "ERROR in breakpoint-deprecated( #{ $size } ): Please wrap the breakpoint $size in parenthesis. You can use these sizes[ #{$sizes} ] using the following syntax [ <#{ nth( $breakpoints, 1 ) } >#{ nth( $breakpoints, 1 ) } #{ nth( $breakpoints, 1 ) }-#{ nth( $breakpoints, 2 ) } ]";
		}
	}
}
