1
0
Fork 0
blog/src/global/_mixins.scss

135 lines
2.7 KiB
SCSS
Raw Normal View History

2018-07-18 23:04:31 +02:00
@import 'variables';
// CSS image replacement
/////////////////////////////////////
@mixin hide-text() {
2019-10-02 13:35:50 +02:00
font: 0/0 a; // stylelint-disable font-family-no-missing-generic-family-keyword
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
2018-07-18 23:04:31 +02:00
}
// Text overflow
/////////////////////////////////////
2018-07-21 23:30:16 +02:00
@mixin ellipsis() {
2019-10-02 13:35:50 +02:00
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
2018-07-18 23:04:31 +02:00
}
// Layout breakout
/////////////////////////////////////
@mixin breakoutviewport() {
2019-10-02 13:35:50 +02:00
margin-left: calc(-50vw + 50%);
margin-right: calc(-50vw + 50%);
2018-07-18 23:04:31 +02:00
2019-10-02 13:35:50 +02:00
@media (min-width: $screen-md) {
@include breakoutviewport--base();
}
2018-07-18 23:04:31 +02:00
}
@mixin breakoutviewport--base() {
2019-10-02 13:35:50 +02:00
margin-left: -($spacer * 4);
margin-right: -($spacer * 4);
2018-07-18 23:04:31 +02:00
}
@mixin breakoutviewport--full() {
2019-10-02 13:35:50 +02:00
margin-left: calc(-50vw + 50%);
margin-right: calc(-50vw + 50%);
2018-07-18 23:04:31 +02:00
}
// Button sizing
/////////////////////////////////////
@mixin button-size(
2019-10-02 13:35:50 +02:00
$padding-vertical,
$padding-horizontal,
$font-size,
$line-height,
$border-radius
2018-07-18 23:04:31 +02:00
) {
2019-10-02 13:35:50 +02:00
padding: $padding-vertical $padding-horizontal;
font-size: $font-size;
line-height: $line-height;
border-radius: $border-radius;
2018-07-18 23:04:31 +02:00
}
// Form control sizing
/////////////////////////////////////
@mixin input-size(
2019-10-02 13:35:50 +02:00
$padding-vertical,
$padding-horizontal,
$font-size,
$line-height,
$border-radius
2018-07-18 23:04:31 +02:00
) {
2019-10-02 13:35:50 +02:00
padding: $padding-vertical $padding-horizontal;
font-size: $font-size;
line-height: $line-height;
border-radius: $border-radius;
2018-07-18 23:04:31 +02:00
2019-10-02 13:35:50 +02:00
&input[type='search'] {
background-size: $font-size;
background-position: $padding-vertical center;
padding-left: ($padding-vertical * 4);
}
2018-07-18 23:04:31 +02:00
2019-10-02 13:35:50 +02:00
&select {
line-height: $input-height;
}
2018-07-18 23:04:31 +02:00
2019-10-02 13:35:50 +02:00
&textarea,
&select[multiple] {
height: auto;
}
2018-07-18 23:04:31 +02:00
}
// Placeholder text
/////////////////////////////////////
@mixin placeholder($color: $input-color-placeholder) {
2019-10-02 13:35:50 +02:00
&::-moz-placeholder {
color: $color;
opacity: 1; // Override Firefox's unusual default opacity; See https//github.com/twbs/bootstrap/pull/11526
}
2018-07-18 23:04:31 +02:00
2019-10-02 13:35:50 +02:00
&::-webkit-input-placeholder {
color: $color;
}
2018-07-18 23:04:31 +02:00
2019-10-02 13:35:50 +02:00
&:-ms-input-placeholder {
color: $color;
}
2018-07-18 23:04:31 +02:00
}
2018-07-19 00:22:06 +02:00
// Image frame style
/////////////////////////////////////
@mixin media-frame() {
2019-10-02 13:35:50 +02:00
@include transition();
2018-07-19 00:22:06 +02:00
2019-10-02 13:35:50 +02:00
border-top: 2px solid transparent;
border-bottom: 2px solid transparent;
border-radius: $border-radius;
2019-11-11 01:00:26 +01:00
box-shadow: 0 3px 5px rgba($brand-grey, 0.2),
0 5px 16px rgba($brand-grey, 0.2);
2018-07-19 00:22:06 +02:00
2019-10-02 13:35:50 +02:00
@media (min-width: $screen-sm) {
border: 2px solid transparent;
}
:global(.dark) & {
box-shadow: 0 3px 5px rgba(darken($brand-main, 20%), 0.25),
0 5px 16px rgba(darken($brand-main, 20%), 0.25);
}
2019-11-06 21:44:32 +01:00
img {
border-radius: $border-radius;
}
2018-07-19 00:22:06 +02:00
}