Skip to content

Commit

Permalink
Merge pull request #2 from fizzion/basic-setup
Browse files Browse the repository at this point in the history
Build out inital set of mixins
  • Loading branch information
bitfyre authored Mar 23, 2018
2 parents 41a5678 + 6a6f8ee commit f8630ce
Show file tree
Hide file tree
Showing 6 changed files with 2,025 additions and 4 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# fizzion-media-queries
# fizzion-media-queries

## Defaults

```scss
$breakpoints: ('sm': 719, 'md': 1024) !default;
$vertical-breakpoints: ('md': 529, 'lg': 775) !default;
```
64 changes: 64 additions & 0 deletions main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*!
* Fizzion Typography v0.0.1
* Copyright 2018 Alex Lemanski
* Licensed under MIT
* (https://github.com/fizzion/fizzion-media-queries/blob/master/LICENSE.md)
*/

$breakpoints: ('sm': 719, 'md': 1024) !default;
$vertical-breakpoints: ('md': 529, 'lg': 775) !default;

@mixin mq-only($breakpoint) {
$mq-rules: null !default;
@if $breakpoint == 'sm' {
$mq-rules: '(max-width: #{map-get($breakpoints, $breakpoint) + px})';
} @else if $breakpoint == 'md' {
$mq-rules: '(min-width: #{map-get($breakpoints, 'sm') + 1px})
and (max-width: #{map-get($breakpoints, $breakpoint) + px})';
} @else if $breakpoint == 'lg' {
$mq-rules: '(min-width: #{map-get($breakpoints, 'md') + 1px})';
}

@media only screen and #{$mq-rules} {
@content;
}
}

@mixin mq-greater-than($breakpoint) {
@media only screen and (min-width: map-get($breakpoints, $breakpoint) + 1px) {
@content;
}
}

@mixin mq-smaller-than($breakpoint) {
@if $breakpoint == 'sm' {
@error '`#{$breakpoint}` is and invalid option. You probably mean `md`';
}
@if $breakpoint == 'md' {
@media only screen and (max-width: map-get($breakpoints, 'sm') + px) {
@content;
}
} @else if $breakpoint == 'lg' {
@media only screen and (max-width: map-get($breakpoints, 'md') + px) {
@content;
}
}
}

@mixin mq-orientation($orientation) {
@media (orientation: #{$orientation}) {
@content;
}
}

@mixin mq-vertical($breakpoint) {
@if $breakpoint == 'sm' {
@media only screen and (max-height: map-get($vertical-breakpoints, 'md') - 1px) {
@content;
}
} @else {
@media only screen and (min-height: map-get($vertical-breakpoints, $breakpoint) + px) {
@content;
}
}
}
Loading

0 comments on commit f8630ce

Please sign in to comment.