Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
// The only class we need for icons is .icon
2
// Standardize the size, padding and alignment for all icons in Moodle.
3
 
4
// Size of default icons.
1441 ariadna 5
$icon-width: 20px;
1 efrain 6
$icon-height: 16px;
1441 ariadna 7
// Size of medium icons.
8
$icon-medium-width: 40px;
1 efrain 9
$icon-medium-height: 32px;
10
// Size of big icons.
1441 ariadna 11
$icon-big-width: 80px;
1 efrain 12
$icon-big-height: 64px;
13
// Size of icon boxes.
1441 ariadna 14
$icon-box-width: 60px;
1 efrain 15
$icon-box-height: 48px;
16
 
17
// stylelint-disable
18
$iconsizes: () !default;
19
$iconsizes: map-merge((
20
  0: 0,
1441 ariadna 21
  1: ($icon-height * .25),
22
  2: ($icon-height * .5),
23
  3: $icon-height,
24
  4: ($icon-height * 1.5),
25
  5: ($icon-height * 2),
26
  6: ($icon-height * 2.5),
27
  7: ($icon-height * 3)
28
), $iconsizes);
29
$iconwidthsizes: () !default;
30
$iconwidthsizes: map-merge((
31
  0: 0,
1 efrain 32
  1: ($icon-width * .25),
33
  2: ($icon-width * .5),
34
  3: $icon-width,
35
  4: ($icon-width * 1.5),
36
  5: ($icon-width * 2),
37
  6: ($icon-width * 2.5),
38
  7: ($icon-width * 3)
1441 ariadna 39
), $iconwidthsizes);
40
 
1 efrain 41
// stylelint-enable
42
 
1441 ariadna 43
// This mixin change an icon color using filters.
44
// The code is adapted from https://jsfiddle.net/Tegos/3fchp0qm/ example.
45
@mixin recolor-icon($color: #000, $opacity: 1) {
46
    // Extracting the color component using / 255 is deprecated in Sass.
47
    // However, the alternative of using math.div is not working in moodle yet.
48
    // The workaround to extract the color component is multiply by 1/255 as float.
49
    $r: red($color) * 0.00392156862745098;
50
    $g: green($color) * 0.00392156862745098;
51
    $b: blue($color) * 0.00392156862745098;
52
    $a: $opacity;
53
    $svg-filter-id: "recolor";
54
 
55
    $svg-url: 'data:image/svg+xml;utf8,' +
56
        '<svg xmlns="http://www.w3.org/2000/svg">' +
57
        '<filter id="#{$svg-filter-id}" color-interpolation-filters="sRGB">' +
58
        '<feColorMatrix type="matrix" values="' +
59
        '0 0 0 0 #{$r} ' +
60
        '0 0 0 0 #{$g} ' +
61
        '0 0 0 0 #{$b} ' +
62
        '0 0 0 #{$a} 0 ' +
63
        '"/>' +
64
        '</filter>' +
65
        '</svg>' +
66
        '##{$svg-filter-id}';
67
 
68
    filter: url($svg-url);
69
}
70
 
1 efrain 71
.icon {
1441 ariadna 72
    max-width: map-get($iconwidthsizes, 4);
1 efrain 73
    max-height: map-get($iconsizes, 4);
1441 ariadna 74
    margin: 0 map-get($spacers, 2) 0 0;
1 efrain 75
    padding: 0;
76
    box-sizing: content-box;
77
 
78
    &.spacer {
79
        margin-right: 0;
80
    }
81
 
82
    &.iconsize-medium {
83
        font-size: $icon-medium-height;
84
        width: $icon-medium-width;
85
        height: $icon-medium-height;
1441 ariadna 86
        max-width: $icon-medium-width;
87
        max-height: $icon-medium-height;
1 efrain 88
    }
89
 
90
    &.iconsize-big {
91
        width: $icon-big-width;
92
        height: $icon-big-height;
1441 ariadna 93
        max-width: $icon-big-width;
94
        max-height: $icon-big-height;
1 efrain 95
        font-size: $icon-big-height;
96
    }
1441 ariadna 97
 
98
    &.emoticon {
99
        width: map-get($iconsizes, 3);
100
        height: map-get($iconsizes, 3);
101
    }
1 efrain 102
}
103
 
1441 ariadna 104
// Force size for the SVG icons.
105
img.icon {
106
    width: 20px;
107
    height: 16px;
108
}
109
 
1 efrain 110
.navbar-dark a .icon {
111
    color: $navbar-dark-color !important; /* stylelint-disable-line declaration-no-important */
112
}
113
 
114
.action-menu-item a:first-of-type > .icon {
115
    margin-left: 0.5rem;
116
}
117
 
118
// YUI 2 Tree View icons must not have a margin left.
119
.ygtvcell .icon {
120
    margin-left: 0 !important; /* stylelint-disable-line declaration-no-important */
121
}
122
 
123
// In the navigation, tree icons should not have margins.
124
.block_navigation,
125
.block_settings {
126
    .tree_item .icon {
127
        margin-left: 0;
128
    }
129
}
130
 
131
[data-action=toggle-drawer] .icon {
132
    margin: 0;
133
}
134
 
135
// Apply in special cases where the default icons styles does not work properly. Eg file picker buttons.
136
.icon-no-spacing a > .icon {
137
    margin: 0;
138
}
139
 
140
.icon-no-margin {
141
    .icon {
142
        margin-left: 0;
143
        margin-right: 0;
144
        margin-top: 0;
145
        margin-bottom: 0;
146
    }
147
}
148
 
149
.icon-large > .icon {
150
    width: ($icon-width * 2);
151
    height: ($icon-height * 2);
152
}
153
 
154
@each $size, $length in $iconsizes {
155
    .icon-size-#{$size} {
156
        .icon {
157
            height: $length !important; /* stylelint-disable-line declaration-no-important */
1441 ariadna 158
            width: map-get($iconwidthsizes, $size) !important; /* stylelint-disable-line declaration-no-important */
159
            max-height: $length !important; /* stylelint-disable-line declaration-no-important */
160
            max-width: map-get($iconwidthsizes, $size) !important; /* stylelint-disable-line declaration-no-important */
1 efrain 161
            font-size: $length !important; /* stylelint-disable-line declaration-no-important */
162
        }
163
    }
164
}
165
 
166
.helplink .icon {
167
    margin-left: 0.5rem;
168
}
169
 
170
.icons-collapse-expand {
171
    display: flex;
172
    align-items: center;
173
    .expanded-icon {
174
        display: flex;
175
        align-items: center;
176
    }
177
 
178
    .collapsed-icon {
179
        display: none;
180
    }
181
 
182
    &.collapsed {
183
        .expanded-icon {
184
            display: none;
185
        }
186
 
187
        .collapsed-icon {
188
            display: flex;
189
            align-items: center;
190
        }
191
    }
192
}
193
 
194
// Revisit these styles when MDL-78284 lands with new icons.
195
// Icon container will be removed and icons will be used directly.
196
.activityiconcontainer {
197
    display: inline-flex;
198
    justify-content: center;
199
    align-items: center;
200
    border-radius: 4px;
201
    .activityicon,
202
    .icon {
203
        margin: 0;
1441 ariadna 204
        font-size: $icon-medium-height;
205
        height: $icon-medium-height;
206
        width: $icon-medium-width;
207
        max-height: $icon-medium-height;
208
        max-width: $icon-medium-width;
1 efrain 209
    }
210
    &.small {
211
        width: $activity-iconcontainer-width - 10px;
212
        height: $activity-iconcontainer-height - 10px;
213
        max-width: $activity-iconcontainer-width - 10px;
214
        max-height: $activity-iconcontainer-height - 10px;
215
    }
216
    &.smaller {
217
        width: $activity-iconcontainer-width - 20px;
1441 ariadna 218
        height: $activity-iconcontainer-height - 20px;
1 efrain 219
        max-width: $activity-iconcontainer-width - 20px;
1441 ariadna 220
        max-height: $activity-iconcontainer-height - 20px;
1 efrain 221
        .activityicon {
222
            width: $icon-medium-width;
223
            height: $icon-medium-height;
224
            max-width: $icon-medium-width;
225
            max-height: $icon-medium-height;
226
        }
227
    }
228
}
229
 
230
@each $type, $value in $activity-icon-colors {
231
    .activityiconcontainer.#{$type} {
232
        &:not(.isbranded) {
233
            .activityicon,
234
            .icon {
235
                &:not(.nofilter) {
1441 ariadna 236
                    @include recolor-icon($value, 1);
1 efrain 237
                }
238
            }
239
        }
240
    }
241
}
242
 
243
.icon-box {
244
    width: $icon-box-width;
245
    height: $icon-box-height;
246
    display: inline-flex;
247
    justify-content: center;
248
    align-items: center;
249
    background-color: $gray-100;
250
    border-radius: 12px;
251
    padding: 0.7rem;
252
 
253
    .icon {
254
        margin: 0;
255
        height: $icon-medium-width;
256
        width: $icon-medium-height;
257
    }
258
}
259
 
260
.icon-circle {
261
    display: inline-block;
262
    background-color: darken($gray-400, 4%);
263
    border-radius: 50%;
264
    padding: 1.3rem;
265
 
266
    .icon {
267
        margin: 0;
268
        text-align: center;
269
        max-width: unset;
270
        max-height: unset;
271
        color: $black;
272
    }
273
 
274
    &.reversed {
275
        background-color: darken($gray-400, 8%);
276
        .icon {
277
            color: $white;
278
        }
279
    }
280
}
281
 
282
// Make activtity colours available for custom modules.
283
:root {
284
    @each $type, $value in $activity-icon-colors {
285
        --activity#{$type}: #{$value};
286
    }
287
}