UNPKG

3.44 kBSCSSView Raw
1// Color of overlay background
2$color-overlay: rgba(0, 0, 0, .5) !default;
3
4// Position of dialog
5$dialog-position-top: 1.75rem !default;
6$dialog-position-bottom: 1.75rem !default;
7$dialog-position-left: 1.75rem !default;
8$dialog-position-right: 1.75rem !default;
9
10// Transition time
11// !! The same as the hideDelay variable defined in ngx-smart-modal.component.ts
12$transition-duration: 500ms !default;
13
14// Transition effect
15// linear | ease | ease-in | ease-out | ease-in-out
16$transition-timing-function: ease-in-out !default;
17
18// Body overflow when a modal is opened.
19// Set it to `auto` if you want to unlock the page scroll when a modal is opened
20$opened-modal-body-overflow: hidden !default;
21
22// Body if modal is opened
23body.dialog-open {
24 overflow: $opened-modal-body-overflow;
25}
26
27// Close button in modal
28.nsm-dialog-btn-close {
29 border: 0;
30 background: none;
31 position: absolute;
32 top: 8px;
33 right: 8px;
34 font-size: 1.2em;
35 cursor: pointer;
36}
37
38// Overlay
39.overlay {
40 position: fixed;
41 top: 0;
42 bottom: 0;
43 left: 0;
44 right: 0;
45 overflow-x: hidden;
46 overflow-y: auto;
47 transition: background-color $transition-duration;
48 background-color: transparent;
49 z-index: 999;
50
51 &.nsm-overlay-open {
52 background-color: $color-overlay;
53 }
54
55 &.transparent {
56 background-color: transparent;
57 }
58}
59
60// Dialog modal
61.nsm-dialog {
62 position: relative;
63 opacity: 1;
64 visibility: visible;
65 min-height: 200px;
66 width: 100%;
67 max-width: 520px;
68 margin: 0 auto;
69 pointer-events: none;
70 outline: none;
71
72 // When dialog is closing
73 &.nsm-dialog-close {
74 opacity: 0;
75 }
76
77 &.nsm-centered {
78 display: flex;
79 align-items: center;
80 min-height: calc(100% - (1.75rem * 2));
81 }
82}
83
84.nsm-content {
85 position: relative;
86 display: flex;
87 flex-direction: column;
88 pointer-events: auto;
89 background-clip: padding-box;
90 background-color: #fff;
91 border-radius: 2px;
92 padding: 1rem;
93 margin-top: $dialog-position-top;
94 margin-bottom: $dialog-position-bottom;
95 margin-left: $dialog-position-left;
96 margin-right: $dialog-position-right;
97 box-shadow: 0 7px 8px -4px rgba(0, 0, 0, .2), 0 13px 19px 2px rgba(0, 0, 0, .14), 0 5px 24px 4px rgba(0, 0, 0, .12);
98 outline: 0;
99
100 // For performance purpose
101 transform: translate3d(0, 0, 0);
102}
103
104.nsm-body {
105 position: relative;
106 flex: 1 1 auto;
107}
108
109/* *************************
110* Animations
111* *************************/
112
113.nsm-dialog[class*=nsm-dialog-animation-] {
114 transition: transform $transition-duration $transition-timing-function, opacity $transition-duration;
115}
116
117// Left to right (ltr)
118.nsm-dialog-animation-ltr {
119 transform: translate3d(-50%, 0, 0);
120
121 &.nsm-dialog-open {
122 transform: translate3d(0, 0, 0);
123 }
124
125 &.nsm-dialog-close {
126 transform: translate3d(-50%, 0, 0);
127 }
128}
129
130// Right to left (ltr)
131.nsm-dialog-animation-rtl {
132 transform: translate3d(50%, 0, 0);
133
134 &.nsm-dialog-open {
135 transform: translate3d(0, 0, 0);
136 }
137
138 &.nsm-dialog-close {
139 transform: translate3d(50%, 0, 0);
140 }
141}
142
143// Top to bottom (ttb)
144.nsm-dialog-animation-ttb {
145 transform: translate3d(0, -50%, 0);
146
147 &.nsm-dialog-open {
148 transform: translate3d(0, 0, 0);
149 }
150
151 &.nsm-dialog-close {
152 transform: translate3d(0, -50%, 0);
153 }
154}
155
156// Bottom to top (btt)
157.nsm-dialog-animation-btt {
158 transform: translate3d(0, 50%, 0);
159
160 &.nsm-dialog-open {
161 transform: translate3d(0, 0, 0);
162 }
163
164 &.nsm-dialog-close {
165 transform: translate3d(0, 50%, 0);
166 }
167}