// _mixins.scss // // Useful utilities and mixins for SCSS files. @mixin button-style($bgColor, $borderColor, $activeBgColor, $activeBorderColor, $color) { color: $color; background-color: $bgColor; border-color: $borderColor; // Give desktop users something to play with &:hover { color: $color; text-decoration: none; // TODO: Verify if we should keep this or not. Feels weird on Safari // Since the button shows the hover state after clicking, but we only // want it on desktop //background-color: lighten($bgColor, 10%); } &.active, &:active { background-color: $activeBgColor; box-shadow: inset 0px 1px 3px rgba(0,0,0,0.15); border-color: $activeBorderColor; } } @mixin button-clear($color, $fontSize:"") { &.button-clear { color: $color; background: none; box-shadow: none; @if $fontSize != "" { font-size: $fontSize; } } } @mixin button-outline($color, $textColor:"") { &.button-outline { border-color: $color; @if $textColor == "" { $textColor: $color; } color: $textColor; &.active, &:active { background-color: $color; color: #fff; box-shadow: none; } } } @mixin list-style($bgColor, $borderColor, $color) { color: $color; background-color: $bgColor; border-color: $borderColor; // Give desktop users something to play with &:hover { color: $color; text-decoration: none; // TODO: Verify if we should keep this or not. Feels weird on Safari // Since the button shows the hover state after clicking, but we only // want it on desktop //background-color: lighten($bgColor, 10%); } &.active, &:active { background-color: darken($bgColor, 8%); box-shadow: inset 0px 1px 3px rgba(0,0,0,0.12); border-color: darken($borderColor, 10%); } } //$bgColor, $borderColor, $color, @mixin list-item-style-active($activeBgColor, $activeBorderColor, $activeColor) { /* color: $color; background-color: $bgColor; border-color: $borderColor; */ &.active, &:active { color: $activeColor; background-color: $activeBgColor; border-color: $activeBorderColor; .list-item-content { background-color: $activeBgColor; color: $activeColor; } } }; @mixin bar-style($bgColor, $borderColor, $color) { background-color: $bgColor; border-color: $borderColor; color: $color; .title { color: $color; } } @mixin tab-style($bgColor, $borderColor, $color) { background-color: $bgColor; border-color: $borderColor; color: $color; } // UTILITY MIXINS // -------------------------------------------------- // Clearfix // -------- // For clearing floats like a boss h5bp.com/q @mixin clearfix { *zoom: 1; &:before, &:after { display: table; content: ""; // Fixes Opera/contenteditable bug: // http://nicolasgallagher.com/micro-clearfix-hack/#comment-36952 line-height: 0; } &:after { clear: both; } } // Webkit-style focus // ------------------ @mixin tab-focus() { // Default outline: thin dotted #333; // Webkit outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } // Center-align a block level element // ---------------------------------- @mixin center-block() { display: block; margin-left: auto; margin-right: auto; } // Sizing shortcuts // ------------------------- @mixin size($height, $width) { width: $width; height: $height; } @mixin square($size) { @include size($size, $size); } // Placeholder text // ------------------------- @mixin placeholder($color: $input-color-placeholder) { &:-moz-placeholder { color: $color; } &:-ms-input-placeholder { color: $color; } &::-webkit-input-placeholder { color: $color; } } // Text overflow // ------------------------- // Requires inline-block or block for proper styling @mixin text-overflow() { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } // FONTS // -------------------------------------------------- @mixin font-family-serif() { font-family: $serif-font-family; } @mixin font-family-sans-serif() { font-family: $sans-font-family; } @mixin font-family-monospace() { font-family: $mono-font-family; } @mixin font-shorthand($size: $baseFontSize, $weight: normal, $lineHeight: $baseLineHeight) { font-size: $size; font-weight: $weight; line-height: $lineHeight; } @mixin font-serif($size: $baseFontSize, $weight: normal, $lineHeight: $baseLineHeight) { @include font-family-serif(); @include font-shorthand($size, $weight, $lineHeight); } @mixin font-sans-serif($size: $baseFontSize, $weight: normal, $lineHeight: $baseLineHeight) { @include font-family-sans-serif(); @include font-shorthand($size, $weight, $lineHeight); } @mixin font-monospace($size: $baseFontSize, $weight: normal, $lineHeight: $baseLineHeight) { @include font-family-monospace(); @include font-shorthand($size, $weight, $lineHeight); } // CSS3 PROPERTIES // -------------------------------------------------- // Border Radius @mixin border-radius($radius) { -webkit-border-radius: $radius; -moz-border-radius: $radius; border-radius: $radius; } // Single Corner Border Radius @mixin border-top-left-radius($radius) { -webkit-border-top-left-radius: $radius; -moz-border-radius-topleft: $radius; border-top-left-radius: $radius; } @mixin border-top-right-radius($radius) { -webkit-border-top-right-radius: $radius; -moz-border-radius-topright: $radius; border-top-right-radius: $radius; } @mixin border-bottom-right-radius($radius) { -webkit-border-bottom-right-radius: $radius; -moz-border-radius-bottomright: $radius; border-bottom-right-radius: $radius; } @mixin border-bottom-left-radius($radius) { -webkit-border-bottom-left-radius: $radius; -moz-border-radius-bottomleft: $radius; border-bottom-left-radius: $radius; } // Single Side Border Radius @mixin border-top-radius($radius) { @include border-top-right-radius($radius); @include border-top-left-radius($radius); } @mixin border-right-radius($radius) { @include border-top-right-radius($radius); @include border-bottom-right-radius($radius); } @mixin border-bottom-radius($radius) { @include border-bottom-right-radius($radius); @include border-bottom-left-radius($radius); } @mixin border-left-radius($radius) { @include border-top-left-radius($radius); @include border-bottom-left-radius($radius); } // Drop shadows @mixin box-shadow($shadow...) { -webkit-box-shadow: $shadow; -moz-box-shadow: $shadow; box-shadow: $shadow; } // Transitions @mixin transition($transition...) { -webkit-transition: $transition; transition: $transition; } @mixin transition-delay($transition-delay) { -webkit-transition-delay: $transition-delay; transition-delay: $transition-delay; } @mixin transition-duration($transition-duration) { -webkit-transition-duration: $transition-duration; transition-duration: $transition-duration; } // Transformations @mixin rotate($degrees) { -webkit-transform: rotate($degrees); transform: rotate($degrees); } @mixin scale($ratio) { -webkit-transform: scale($ratio); transform: scale($ratio); } @mixin translate($x, $y) { -webkit-transform: translate($x, $y); transform: translate($x, $y); } @mixin skew($x, $y) { -webkit-transform: skew($x, $y); transform: skew($x, $y); -webkit-backface-visibility: hidden; // See https://github.com/twitter/bootstrap/issues/5319 } @mixin translate3d($x, $y, $z) { -webkit-transform: translate3d($x, $y, $z); transform: translate3d($x, $y, $z); } // Backface visibility // Prevent browsers from flickering when using CSS 3D transforms. // Default value is `visible`, but can be changed to `hidden // See git pull https://github.com/dannykeane/bootstrap.git backface-visibility for examples @mixin backface-visibility($visibility){ -webkit-backface-visibility: $visibility; backface-visibility: $visibility; } // Background clipping // Heads up: FF 3.6 and under need "padding" instead of "padding-box" @mixin background-clip($clip) { -webkit-background-clip: $clip; -moz-background-clip: $clip; background-clip: $clip; } // Background sizing @mixin background-size($size) { -webkit-background-size: $size; -moz-background-size: $size; -o-background-size: $size; background-size: $size; } // Box sizing @mixin box-sizing($boxmodel) { -webkit-box-sizing: $boxmodel; -moz-box-sizing: $boxmodel; box-sizing: $boxmodel; } // User select // For selecting text on the page @mixin user-select($select) { -webkit-user-select: $select; -moz-user-select: $select; -ms-user-select: $select; -o-user-select: $select; user-select: $select; } @mixin disable-user-select() { -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: -moz-none; user-select: none; } // Resize anything @mixin resizable($direction) { resize: $direction; // Options: horizontal, vertical, both overflow: auto; // Safari fix } // CSS3 Content Columns @mixin content-columns($columnCount, $columnGap: $gridGutterWidth) { -webkit-column-count: $columnCount; -moz-column-count: $columnCount; column-count: $columnCount; -webkit-column-gap: $columnGap; -moz-column-gap: $columnGap; column-gap: $columnGap; } // Optional hyphenation @mixin hyphens($mode: auto) { word-wrap: break-word; -webkit-hyphens: $mode; -moz-hyphens: $mode; -ms-hyphens: $mode; -o-hyphens: $mode; hyphens: $mode; } @mixin box-orient($orientation) { box-orient: $orientation; -webkit-box-orient: $orientation; -moz-box-orient: $orientation; } @mixin box-flex($flex) { box-flex: 1; -webkit-box-flex: $flex; -moz-box-flex: $flex; }