-
Notifications
You must be signed in to change notification settings - Fork 38
/
_toast.scss
93 lines (83 loc) · 3.04 KB
/
_toast.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
@use '@justeat/pie-design-tokens/dist/jet' as dt;
@use '../../settings/include-media' as *;
@use '../../tools/functions/index' as functions;
@mixin toast() {
/**
* Toast Component
* =================================
* Used to display text in a pop-up style notification.
*
* The `c-toast` component is an optional mixin within Fozzie.
If you'd like to use it in your project you can include it by adding `@include toast();` into your SCSS dependencies file.*
*
* Documentation:
* https://fozzie.just-eat.com/styleguide/ui-components/toast
*/
$toast-radius : dt.$radius-rounded-c;
$toast-textColor : dt.$color-content-light;
$toast-bgColor--default : dt.$color-content-interactive-tertiary;
$toast-bgColor--alert : dt.$color-orange-55;
$toast-animation-duration : 0.5s;
$toast-height : 95px;
$toast-translateY : -#{$toast-height - 5px};
$toast-height--aboveNarrow : 115px;
$toast-translateY--aboveNarrow : -#{$toast-height--aboveNarrow - 5px};
$toast-height--aboveMid : 115px;
$toast-translateY--aboveMid : -#{$toast-height--aboveMid - 5px};
@keyframes toast-slide-up {
0% {
transform: translateY(0);
}
100% {
transform: translateY($toast-translateY);
}
}
@keyframes toast-slide-up-above-narrow {
0% {
transform: translateY(0);
}
100% {
transform: translateY($toast-translateY--aboveNarrow);
}
}
@keyframes toast-slide-up-above-mid {
0% {
transform: translateY(0);
}
100% {
transform: translateY($toast-translateY--aboveMid);
}
}
.c-toast {
animation: toast-slide-up $toast-animation-duration;
background-color: $toast-bgColor--default;
border-top-left-radius: $toast-radius;
border-top-right-radius: $toast-radius;
box-shadow: dt.$elevation-05; // token value for 'above elevation'
color: $toast-textColor;
height: $toast-height;
opacity: 0.9;
padding: functions.spacing();
position: absolute;
text-align: center;
transform: translateY($toast-translateY);
width: calc(100% - 16px);
z-index: functions.zIndex(low);
@include media('>=narrow') {
animation: toast-slide-up-above-narrow $toast-animation-duration;
height: $toast-height--aboveNarrow;
transform: translateY($toast-translateY--aboveNarrow);
}
@include media('>=mid') {
animation: toast-slide-up-above-mid $toast-animation-duration;
height: $toast-height--aboveMid;
transform: translateY($toast-translateY--aboveMid);
}
p {
margin: 0;
}
}
.c-toast--alert {
background-color: $toast-bgColor--alert;
}
}