Project

General

Profile

1
// Name:            Notification
2
// Description:     Component to create notification messages
3
//
4
// Component:       `uk-notification`
5
//
6
// Sub-objects:     `uk-notification-message`
7
//
8
// Adopted:         `uk-notification-close`
9
//
10
// Modifiers:       `uk-notification-top-center`
11
//                  `uk-notification-top-right`
12
//                  `uk-notification-bottom-left`
13
//                  `uk-notification-bottom-center`
14
//                  `uk-notification-bottom-right`
15
//                  `uk-notification-message-primary`
16
//                  `uk-notification-message-success`
17
//                  `uk-notification-message-warning`
18
//                  `uk-notification-message-danger`
19
//
20
// ========================================================================
21

    
22

    
23
// Variables
24
// ========================================================================
25

    
26
$notification-position:                                10px !default;
27
$notification-z-index:                                 $global-z-index + 40 !default;
28
$notification-width:                                   350px !default;
29

    
30
$notification-message-margin-bottom:                   10px !default;
31
$notification-message-padding:                         $global-small-gutter !default;
32
$notification-message-background:                      $global-muted-background !default;
33
$notification-message-color:                           $global-color !default;
34
$notification-message-font-size:                       $global-medium-font-size !default;
35
$notification-message-line-height:                     1.4 !default;
36

    
37
$notification-close-top:                               $notification-message-padding + 5px !default;
38
$notification-close-right:                             $notification-message-padding !default;
39

    
40
$notification-message-primary-color:                   $global-primary-background !default;
41
$notification-message-success-color:                   $global-success-background !default;
42
$notification-message-warning-color:                   $global-warning-background !default;
43
$notification-message-danger-color:                    $global-danger-background !default;
44

    
45

    
46
/* ========================================================================
47
   Component: Notification
48
 ========================================================================== */
49

    
50
/*
51
 * 1. Set position
52
 * 2. Dimensions
53
 */
54

    
55
.uk-notification {
56
    /* 1 */
57
    position: fixed;
58
    top: $notification-position;
59
    left: $notification-position;
60
    z-index: $notification-z-index;
61
    /* 2 */
62
    box-sizing: border-box;
63
    width: $notification-width;
64
    @if(mixin-exists(hook-notification)) {@include hook-notification();}
65
}
66

    
67

    
68
/* Position modifiers
69
========================================================================== */
70

    
71
.uk-notification-top-right,
72
.uk-notification-bottom-right {
73
    left: auto;
74
    right: $notification-position;
75
}
76

    
77
.uk-notification-top-center,
78
.uk-notification-bottom-center {
79
    left: 50%;
80
    margin-left: ($notification-width / -2);
81
}
82

    
83
.uk-notification-bottom-left,
84
.uk-notification-bottom-right,
85
.uk-notification-bottom-center {
86
    top: auto;
87
    bottom: $notification-position;
88
}
89

    
90

    
91
/* Responsiveness
92
========================================================================== */
93

    
94
/* Phones portrait and smaller */
95
@media (max-width: $breakpoint-xsmall-max) {
96

    
97
    .uk-notification {
98
        left: $notification-position;
99
        right: $notification-position;
100
        width: auto;
101
        margin: 0;
102
    }
103

    
104
}
105

    
106

    
107
/* Message
108
========================================================================== */
109

    
110
.uk-notification-message {
111
    position: relative;
112
    margin-bottom: $notification-message-margin-bottom;
113
    padding: $notification-message-padding;
114
    background: $notification-message-background;
115
    color: $notification-message-color;
116
    font-size: $notification-message-font-size;
117
    line-height: $notification-message-line-height;
118
    cursor: pointer;
119
    @if(mixin-exists(hook-notification-message)) {@include hook-notification-message();}
120
}
121

    
122

    
123
/* Close
124
 * Adopts `uk-close`
125
 ========================================================================== */
126

    
127
.uk-notification-close {
128
    display: none;
129
    position: absolute;
130
    top: $notification-close-top;
131
    right: $notification-close-right;
132
    @if(mixin-exists(hook-notification-close)) {@include hook-notification-close();}
133
}
134

    
135
.uk-notification-message:hover .uk-notification-close { display: block; }
136

    
137

    
138
/* Style modifiers
139
 ========================================================================== */
140

    
141
/*
142
 * Primary
143
 */
144

    
145
.uk-notification-message-primary {
146
    color: $notification-message-primary-color;
147
    @if(mixin-exists(hook-notification-message-primary)) {@include hook-notification-message-primary();}
148
}
149

    
150
/*
151
 * Success
152
 */
153

    
154
.uk-notification-message-success {
155
    color: $notification-message-success-color;
156
    @if(mixin-exists(hook-notification-message-success)) {@include hook-notification-message-success();}
157
}
158

    
159
/*
160
 * Warning
161
 */
162

    
163
.uk-notification-message-warning {
164
    color: $notification-message-warning-color;
165
    @if(mixin-exists(hook-notification-message-warning)) {@include hook-notification-message-warning();}
166
}
167

    
168
/*
169
 * Danger
170
 */
171

    
172
.uk-notification-message-danger {
173
    color: $notification-message-danger-color;
174
    @if(mixin-exists(hook-notification-message-danger)) {@include hook-notification-message-danger();}
175
}
176

    
177

    
178
// Hooks
179
// ========================================================================
180

    
181
@if(mixin-exists(hook-notification-misc)) {@include hook-notification-misc();}
182

    
183
// @mixin hook-notification(){}
184
// @mixin hook-notification-message(){}
185
// @mixin hook-notification-close(){}
186
// @mixin hook-notification-message-primary(){}
187
// @mixin hook-notification-message-success(){}
188
// @mixin hook-notification-message-warning(){}
189
// @mixin hook-notification-message-danger(){}
190
// @mixin hook-notification-misc(){}
(39-39/66)