/
_mixins.scss
207 lines (176 loc) · 4.21 KB
/
_mixins.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
@mixin break-huge() {
@media ( min-width: #{ ( $break-huge ) } ) {
@content;
}
}
@mixin break-wide() {
@media ( min-width: #{ ( $break-wide ) } ) {
@content;
}
}
@mixin break-large() {
@media ( min-width: #{ ( $break-large ) } ) {
@content;
}
}
@mixin break-medium() {
@media ( min-width: #{ ( $break-medium ) } ) {
@content;
}
}
@mixin break-small() {
@media ( min-width: #{ ( $break-small ) } ) {
@content;
}
}
@mixin break-mobile() {
@media ( min-width: #{ ( $break-mobile ) } ) {
@content;
}
}
/**
* Long content fade mixin
*
* Creates a fading overlay to signify that the content is longer
* than the space allows.
*/
@mixin long-content-fade( $direction: right, $size: 20%, $color: #fff, $edge: 0px, $z-index: false) {
content: '';
display: block;
position: absolute;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
@if $z-index {
z-index: $z-index;
}
@if $direction == 'bottom' {
background: linear-gradient( to top, rgba( $color, 0 ), $color 90% );
left: $edge;
right: $edge;
top: $edge;
bottom: calc(100% - $size);
width: auto;
}
@if $direction == 'top' {
background: linear-gradient( to bottom, rgba( $color, 0 ), $color 90% );
top: calc(100% - $size);
left: $edge;
right: $edge;
bottom: $edge;
width: auto;
}
@if $direction == 'left' {
background: linear-gradient( to left, rgba( $color, 0 ), $color 90% );
top: $edge;
left: $edge;
bottom: $edge;
right: auto;
width: $size;
height: auto;
}
@if $direction == 'right' {
background: linear-gradient( to right, rgba( $color, 0 ), $color 90% );
top: $edge;
bottom: $edge;
right: $edge;
left: auto;
width: $size;
height: auto;
}
}
/**
* Editor Width mixin
*
* This mixin seeks to take the vinegar out of the responsive alignments in the editor.
*/
@mixin editor-width( $width ) {
@media ( min-width: #{ ( $width ) } ) {
@content;
}
}
$visual-editor-max-width-padding: $visual-editor-max-width + $block-mover-padding-visible + $block-mover-padding-visible;
$float-margin: calc( 50% - #{ $visual-editor-max-width-padding / 2 } );
/**
* Button states and focus styles
*/
@mixin button-style__disabled {
opacity: 0.6;
cursor: default;
}
@mixin button-style__hover {
color: $dark-gray-900;
box-shadow: inset 0 0 0 1px $light-gray-500, inset 0 0 0 2px $white;
}
@mixin button-style__active() {
outline: none;
color: $dark-gray-900;
box-shadow: inset 0 0 0 1px $light-gray-700, inset 0 0 0 2px $white, 0 1px 1px rgba( $dark-gray-900, .2 );
}
@mixin button-style__focus-active() {
outline: none;
color: $dark-gray-900;
box-shadow: inset 0 0 0 1px $dark-gray-300, inset 0 0 0 2px $white;
}
@mixin tab-style__focus-active() {
outline: none;
color: $dark-gray-900;
box-shadow: inset 0 0 0 1px $dark-gray-300;
}
@mixin input-style__focus-active() {
outline: none;
color: $dark-gray-900;
box-shadow: 0 0 0 1px $dark-gray-300;
}
/**
* Applies editor left position to the selector passed as argument
*/
@mixin editor-left( $selector ) {
.sticky-menu #{$selector} { /* Sticky is when on smaller breakpoints, nav menu is manually opened */
@include break-medium() {
left: $admin-sidebar-width;
}
}
.auto-fold #{$selector} { /* Auto fold is when on smaller breakpoints, nav menu auto colllapses */
@include break-medium() {
left: $admin-sidebar-width-collapsed;
}
@include break-large() {
left: $admin-sidebar-width;
}
}
/* Sidebar manually collapsed */
.folded #{$selector} {
left: 0;
@include break-medium() {
left: $admin-sidebar-width-collapsed;
}
}
/* Mobile menu opened */
@media ( max-width: #{ ( $break-medium ) } ) {
.auto-fold .wp-responsive-open #{$selector} {
left: $admin-sidebar-width-big;
}
}
/* In small screens with resposive menu expanded there is small white space */
@media ( max-width: #{ ( $break-small ) } ) {
.auto-fold .wp-responsive-open #{$selector} {
margin-left: -18px;
}
}
}
/**
* Applies editor right position to the selector passed as argument
*/
@mixin editor-right( $selector ) {
#{$selector} {
right: 0;
}
.editor-layout.is-sidebar-opened #{$selector} {
right: $sidebar-width;
}
}