discourse/app/assets/stylesheets/common/foundation/mixins.scss
2018-07-12 00:53:24 -04:00

118 lines
2.1 KiB
SCSS

// --------------------------------------------------
// Mixins used throughout the theme
// --------------------------------------------------
// Media queries
// --------------------------------------------------
@mixin small-width {
@media all and (max-width: 850px) {
@content;
}
}
@mixin medium-width {
@media all and (min-width: 1000px) and (max-width: 1139px) {
@content;
}
}
@mixin large-width {
@media all and (min-width: 1140px) {
@content;
}
}
@mixin mobile-portrait {
@media all and (max-width: 320px) {
@content;
}
}
// CSS3 properties
// --------------------------------------------------
// Clearfix
@mixin clearfix() {
&:before,
&:after {
content: "";
display: table;
}
&:after {
clear: both;
}
}
// Border radius
@mixin border-radius-all($radius) {
border-radius: $radius;
}
// Box shadow
@mixin box-shadow($shadow) {
box-shadow: $shadow;
}
// Linear gradient
//noinspection CssOptimizeSimilarProperties
@mixin linear-gradient($start-color, $end-color) {
background-color: $start-color;
background-image: linear-gradient(to bottom, $start-color, $end-color);
}
// Visibility
// --------------------------------------------------
@mixin hover {
.discourse-no-touch & {
&:hover {
@content;
}
}
}
@mixin visible {
opacity: 1;
visibility: visible;
transition-delay: 0s;
}
//
// --------------------------------------------------
// Unselectable (avoids unwanted selections with iPad, touch laptops, etc)
@mixin user-select($mode) {
-webkit-user-select: $mode;
-moz-user-select: $mode;
-ms-user-select: $mode;
}
@mixin unselectable {
@include user-select(none);
}
// Stuff we repeat
@mixin post-aside {
border-left: 5px solid $primary-low;
background-color: blend-primary-secondary(5%);
}
// We still need -webkit for latest iPhone and Safari
@mixin transform($transforms) {
-webkit-transform: $transforms;
transform: $transforms;
}
@mixin appearance-none() {
// resets default browser styles
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}