Skip to content

Commit b83dd64

Browse files
committed
add no support detection
#63
1 parent 4a2f796 commit b83dd64

4 files changed

Lines changed: 78 additions & 0 deletions

File tree

js/angular/components/common/common.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
.directive('baSwipeClose', baSwipeClose)
1010
.directive('baHardToggle', baHardToggle)
1111
.directive('baCloseAll', baCloseAll)
12+
.directive('baNoSupport', baNoSupport)
1213
;
1314

1415
baClose.$inject = ['BaseAppsApi'];
@@ -247,4 +248,21 @@
247248
return false;
248249
}
249250
}
251+
252+
baNoSupport.$inject = ['$window'];
253+
254+
function baNoSupport($window) {
255+
var directive = {
256+
restrict: 'A',
257+
link: link
258+
};
259+
260+
return directive;
261+
262+
function link(scope, element, attrs) {
263+
if (!$window.Modernizr || $window.Modernizr.flexbox) {
264+
element.remove();
265+
}
266+
}
267+
}
250268
})();

scss/_includes.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ $include-css: (
1313
button: true,
1414
button-group: true,
1515
card: true,
16+
compatibility: true,
1617
coloring: true,
1718
extras: true,
1819
forms: true,

scss/base.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"components/button",
3131
"components/button-group",
3232
"components/card",
33+
"components/compatibility",
3334
"components/extras",
3435
"components/forms",
3536
"components/grid",
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
////
2+
/// @group compatibility
3+
////
4+
5+
/// @type Color
6+
$nosupport-overlay: #000000 !default;
7+
8+
/// @type Color
9+
$nosupport-background: $alert-color !default;
10+
11+
/// @type Color
12+
$nosupport-color: isitlight($nosupport-background) !default;
13+
14+
/// @type Number
15+
$nosupport-top: 15% !default;
16+
17+
/// @type Number
18+
$nosupport-width: 50% !default;
19+
20+
/// @type List
21+
$nosupport-font: Arial, Helvetica, sans-serif !important !default;
22+
23+
@include exports(compatibility) {
24+
div[ba-no-support] {
25+
position: absolute;
26+
top: 0;
27+
left: 0;
28+
height: 100%;
29+
width: 100%;
30+
z-index: 10000;
31+
background: $nosupport-overlay; /* fallback */
32+
background: rgba($nosupport-overlay, 0.75);
33+
34+
div {
35+
background: $nosupport-background;
36+
color: $nosupport-color;
37+
width: $nosupport-width;
38+
top: $nosupport-top;
39+
padding: 1%;
40+
position: absolute;
41+
left: 50%;
42+
margin: 0 0 0 (-$nosupport-width/2); /* add negative left margin for half the width to center the div */
43+
cursor: default;
44+
z-index: 10001;
45+
border-radius: 4px;
46+
box-shadow: 0 0 5px rgba($nosupport-overlay, 0.9);
47+
48+
a {
49+
color: $nosupport-color;
50+
font-weight: bold;
51+
}
52+
53+
p, a {
54+
font-family: $nosupport-font;
55+
}
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)