aboutsummaryrefslogtreecommitdiff
path: root/scss/helpers
diff options
context:
space:
mode:
authorMartijn Cuppens <[email protected]>2019-05-23 11:56:03 +0200
committerGitHub <[email protected]>2019-05-23 11:56:03 +0200
commit769c8d824600fbf521e3976cc4a3c6152ed4e8ce (patch)
tree270b5b5a1590e774f02a0baad9b5e66a1922b64e /scss/helpers
parenta4a04cd9ec741050390746f8056cc79a9c04c8df (diff)
downloadbootstrap-769c8d824600fbf521e3976cc4a3c6152ed4e8ce.tar.xz
bootstrap-769c8d824600fbf521e3976cc4a3c6152ed4e8ce.zip
Helpers & utilities split (#28445)
Diffstat (limited to 'scss/helpers')
-rw-r--r--scss/helpers/_background.scss5
-rw-r--r--scss/helpers/_clearfix.scss3
-rw-r--r--scss/helpers/_embed.scss36
-rw-r--r--scss/helpers/_position.scss27
-rw-r--r--scss/helpers/_screenreaders.scss8
-rw-r--r--scss/helpers/_stretched-link.scss19
-rw-r--r--scss/helpers/_text.scss7
7 files changed, 105 insertions, 0 deletions
diff --git a/scss/helpers/_background.scss b/scss/helpers/_background.scss
new file mode 100644
index 000000000..1c0a32a23
--- /dev/null
+++ b/scss/helpers/_background.scss
@@ -0,0 +1,5 @@
+@if $enable-gradients {
+ @each $color, $value in $theme-colors {
+ @include bg-gradient-variant(".bg-gradient-#{$color}", $value);
+ }
+}
diff --git a/scss/helpers/_clearfix.scss b/scss/helpers/_clearfix.scss
new file mode 100644
index 000000000..e92522a94
--- /dev/null
+++ b/scss/helpers/_clearfix.scss
@@ -0,0 +1,3 @@
+.clearfix {
+ @include clearfix();
+}
diff --git a/scss/helpers/_embed.scss b/scss/helpers/_embed.scss
new file mode 100644
index 000000000..89d22aa6c
--- /dev/null
+++ b/scss/helpers/_embed.scss
@@ -0,0 +1,36 @@
+// Credit: Nicolas Gallagher and SUIT CSS.
+
+.embed-responsive {
+ position: relative;
+ display: block;
+ width: 100%;
+ padding: 0;
+ overflow: hidden;
+
+ &::before {
+ display: block;
+ content: "";
+ }
+
+ .embed-responsive-item,
+ iframe,
+ embed,
+ object,
+ video {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ border: 0;
+ }
+}
+
+@each $key, $ratio in $embed-responsive-aspect-ratios {
+ .embed-responsive-#{$key} {
+ &::before {
+ padding-top: percentage(map-get($ratio, y) / map-get($ratio, x));
+ }
+ }
+}
diff --git a/scss/helpers/_position.scss b/scss/helpers/_position.scss
new file mode 100644
index 000000000..e0c4c2c11
--- /dev/null
+++ b/scss/helpers/_position.scss
@@ -0,0 +1,27 @@
+// stylelint-disable declaration-no-important
+
+// Shorthand
+
+.fixed-top {
+ position: fixed;
+ top: 0;
+ right: 0;
+ left: 0;
+ z-index: $zindex-fixed;
+}
+
+.fixed-bottom {
+ position: fixed;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ z-index: $zindex-fixed;
+}
+
+.sticky-top {
+ @supports (position: sticky) {
+ position: sticky;
+ top: 0;
+ z-index: $zindex-sticky;
+ }
+}
diff --git a/scss/helpers/_screenreaders.scss b/scss/helpers/_screenreaders.scss
new file mode 100644
index 000000000..c8034d10e
--- /dev/null
+++ b/scss/helpers/_screenreaders.scss
@@ -0,0 +1,8 @@
+//
+// Screenreaders
+//
+
+.sr-only,
+.sr-only-focusable:not(:focus) {
+ @include sr-only();
+}
diff --git a/scss/helpers/_stretched-link.scss b/scss/helpers/_stretched-link.scss
new file mode 100644
index 000000000..fb5066bf5
--- /dev/null
+++ b/scss/helpers/_stretched-link.scss
@@ -0,0 +1,19 @@
+//
+// Stretched link
+//
+
+.stretched-link {
+ &::after {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ z-index: 1;
+ // Just in case `pointer-events: none` is set on a parent
+ pointer-events: auto;
+ content: "";
+ // IE10 bugfix, see https://stackoverflow.com/questions/16947967/ie10-hover-pseudo-class-doesnt-work-without-background-color
+ background-color: rgba(0, 0, 0, 0);
+ }
+}
diff --git a/scss/helpers/_text.scss b/scss/helpers/_text.scss
new file mode 100644
index 000000000..419703f1c
--- /dev/null
+++ b/scss/helpers/_text.scss
@@ -0,0 +1,7 @@
+//
+// Text
+//
+
+.text-truncate {
+ @include text-truncate;
+}