5 An alert that pins to the corner of the screen when triggered by JavaScript. It can be set to disappear after a certain period of time, or to stay put until the user clicks on it. A custom action can be asigned to a notification as well.
7 Optionally, the notifications directive can also tap into the browser's native notification support, if it exists.
10 /// @Foundation.settings
12 $notification-default-position: right top !default;
13 $notification-width: rem-calc(400) !default;
14 $notification-offset: $global-padding !default;
16 $notification-background: $primary-color !default;
17 $notification-color: white !default;
18 $notification-padding: $global-padding !default;
19 $notification-radius: 4px !default;
21 $notification-icon-size: 60px !default;
22 $notification-icon-margin: $global-padding !default;
23 $notification-icon-align: top !default;
43 // Placeholder animation
44 // transition: opacity 1s ease-out;
55 %notification-container {
60 flex-direction: column;
63 @mixin notification-layout(
64 $x: nth($notification-default-position, 1),
65 $y: nth($notification-default-position, 2),
66 $size: $notification-width,
67 $offset: $notification-offset
77 @else if $x == middle {
79 margin-left: -($size / 2);
85 @else if $y == bottom {
90 // On small screens, notifications are full width but maintain their vertical orientation
91 @include breakpoint(small only) {
98 @mixin notification-style(
99 $background: $notification-background,
100 $color: $notification-color,
101 $padding: $notification-padding,
102 $radius: $notification-radius
104 background: $background;
106 border-radius: $radius;
108 &, h1, h2, h3, h4, h5, h6 {
114 $background: $notification-background,
115 $color: $notification-color,
116 $padding: $notification-padding,
117 $radius: $notification-radius
119 @extend %notification;
120 @include notification-style($background, $color, $padding, $radius);
123 @mixin notification-container(
124 $x: nth($notification-default-position, 1),
125 $y: nth($notification-default-position, 2),
126 $size: $notification-width,
127 $offset: $notification-offset
129 @extend %notification-container;
130 @include notification-layout($x, $y, $size, $offset);
133 @mixin notification-icon(
134 $size: $notification-icon-size,
135 $margin: $notification-icon-margin,
136 $align: $notification-icon-align
144 margin-right: $global-padding;
145 align-self: map-get($alignments, $align);
157 @include exports(notification) {
159 @include notification;
161 &.success { @include notification-style($success-color) }
162 &.warning { @include notification-style($warning-color) }
163 &.alert { @include notification-style($alert-color) }
164 &.dark { @include notification-style($dark-color, #fff) }
169 .static-notification {
170 @include notification;
172 position: fixed !important;
174 &.top-right { @include notification-layout(right, top); }
175 &.top-left { @include notification-layout(left, top); }
176 &.top-middle { @include notification-layout(middle, top); }
178 &.bottom-right { @include notification-layout(right, bottom); }
179 &.bottom-left { @include notification-layout(left, bottom); }
180 &.bottom-middle { @include notification-layout(middle, bottom); }
182 &.success { @include notification-style($success-color) }
183 &.warning { @include notification-style($warning-color) }
184 &.alert { @include notification-style($alert-color) }
185 &.dark { @include notification-style($dark-color, #fff) }
188 .notification-container {
189 @include notification-container;
191 &.top-right { @include notification-layout(right, top); }
192 &.top-left { @include notification-layout(left, top); }
193 &.top-middle { @include notification-layout(middle, top); }
195 &.bottom-right { @include notification-layout(right, bottom); }
196 &.bottom-left { @include notification-layout(left, bottom); }
197 &.bottom-middle { @include notification-layout(middle, bottom); }
201 @include notification-icon;
203 .notification-content {