1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | @use 'sass:math';
|
22 | @use '@material/feature-targeting/feature-targeting';
|
23 | @use '@material/shape/mixins' as shape-mixins;
|
24 | @use '@material/shape/functions' as shape-functions;
|
25 | @use '@material/theme/theme';
|
26 | @use '@material/typography/typography';
|
27 | @use './variables';
|
28 |
|
29 | @mixin core-styles($query: feature-targeting.all()) {
|
30 | $feat-color: feature-targeting.create-target($query, color);
|
31 | $feat-structure: feature-targeting.create-target($query, structure);
|
32 |
|
33 |
|
34 | .mdc-image-list {
|
35 | @include feature-targeting.targets($feat-structure) {
|
36 | display: flex;
|
37 | flex-wrap: wrap;
|
38 |
|
39 | margin: 0 auto;
|
40 | padding: 0;
|
41 | }
|
42 | }
|
43 |
|
44 | .mdc-image-list__item,
|
45 | .mdc-image-list__image-aspect-container {
|
46 | @include feature-targeting.targets($feat-structure) {
|
47 |
|
48 | position: relative;
|
49 | box-sizing: border-box;
|
50 | }
|
51 | }
|
52 |
|
53 | .mdc-image-list__item {
|
54 | @include feature-targeting.targets($feat-structure) {
|
55 | list-style-type: none;
|
56 | }
|
57 | }
|
58 |
|
59 | .mdc-image-list__image {
|
60 | @include feature-targeting.targets($feat-structure) {
|
61 | width: 100%;
|
62 | }
|
63 | }
|
64 |
|
65 |
|
66 | .mdc-image-list__image-aspect-container .mdc-image-list__image {
|
67 | @include feature-targeting.targets($feat-structure) {
|
68 | position: absolute;
|
69 | top: 0;
|
70 | right: 0;
|
71 | bottom: 0;
|
72 | left: 0;
|
73 | height: 100%;
|
74 |
|
75 | background-repeat: no-repeat;
|
76 | background-position: center;
|
77 | background-size: cover;
|
78 | }
|
79 | }
|
80 |
|
81 | @include aspect(1, $query: $query);
|
82 | @include shape-radius(variables.$shape-radius, $query: $query);
|
83 |
|
84 | .mdc-image-list__supporting {
|
85 | @include feature-targeting.targets($feat-color) {
|
86 | @include theme.property(color, text-primary-on-background);
|
87 | }
|
88 |
|
89 | @include feature-targeting.targets($feat-structure) {
|
90 | display: flex;
|
91 | align-items: center;
|
92 | justify-content: space-between;
|
93 | box-sizing: border-box;
|
94 | padding: 8px 0;
|
95 | line-height: variables.$icon-size;
|
96 | }
|
97 | }
|
98 |
|
99 | .mdc-image-list__label {
|
100 | @include typography.typography(subtitle1, $query: $query);
|
101 | @include typography.overflow-ellipsis($query: $query);
|
102 | }
|
103 |
|
104 |
|
105 |
|
106 | .mdc-image-list--with-text-protection .mdc-image-list__supporting {
|
107 | @include feature-targeting.targets($feat-structure) {
|
108 | position: absolute;
|
109 | bottom: 0;
|
110 | width: 100%;
|
111 | height: variables.$text-protection-height;
|
112 | padding: 0 variables.$text-protection-horizontal-padding;
|
113 | }
|
114 |
|
115 | @include feature-targeting.targets($feat-color) {
|
116 | background: variables.$text-protection-background-color;
|
117 | color: #fff;
|
118 | }
|
119 | }
|
120 |
|
121 |
|
122 |
|
123 | .mdc-image-list--masonry {
|
124 | @include feature-targeting.targets($feat-structure) {
|
125 | display: block;
|
126 | }
|
127 |
|
128 | .mdc-image-list__item {
|
129 | @include feature-targeting.targets($feat-structure) {
|
130 | break-inside: avoid-column;
|
131 | }
|
132 | }
|
133 |
|
134 | .mdc-image-list__image {
|
135 | @include feature-targeting.targets($feat-structure) {
|
136 | display: block;
|
137 | height: auto;
|
138 | }
|
139 | }
|
140 | }
|
141 |
|
142 | }
|
143 |
|
144 | @mixin aspect($width-height-ratio, $query: feature-targeting.all()) {
|
145 | $feat-structure: feature-targeting.create-target($query, structure);
|
146 |
|
147 | .mdc-image-list__image-aspect-container {
|
148 | @include feature-targeting.targets($feat-structure) {
|
149 | padding-bottom: calc(100% / #{$width-height-ratio});
|
150 | }
|
151 | }
|
152 | }
|
153 |
|
154 | @mixin shape-radius(
|
155 | $radius,
|
156 | $rtl-reflexive: false,
|
157 | $query: feature-targeting.all()
|
158 | ) {
|
159 | .mdc-image-list__image {
|
160 | @include shape-mixins.radius($radius, $rtl-reflexive, $query: $query);
|
161 | }
|
162 |
|
163 | $selector: if(
|
164 | &,
|
165 | '&.mdc-image-list--with-text-protection',
|
166 | '.mdc-image-list--with-text-protection'
|
167 | );
|
168 |
|
169 | #{$selector} .mdc-image-list__supporting {
|
170 | $masked-radius: shape-functions.mask-radius($radius, 0 0 1 1);
|
171 |
|
172 | @include shape-mixins.radius(
|
173 | $masked-radius,
|
174 | $rtl-reflexive,
|
175 | $query: $query
|
176 | );
|
177 | }
|
178 | }
|
179 |
|
180 |
|
181 |
|
182 | @mixin standard-columns(
|
183 | $column-count,
|
184 | $gutter-size: variables.$standard-gutter-size,
|
185 | $query: feature-targeting.all()
|
186 | ) {
|
187 | $feat-structure: feature-targeting.create-target($query, structure);
|
188 |
|
189 |
|
190 |
|
191 | .mdc-image-list__item {
|
192 | @include feature-targeting.targets($feat-structure) {
|
193 |
|
194 | width: calc(
|
195 | 100% / #{$column-count} - #{$gutter-size + math.div(1, $column-count)}
|
196 | );
|
197 | margin: math.div($gutter-size, 2);
|
198 | }
|
199 | }
|
200 | }
|
201 |
|
202 |
|
203 |
|
204 | @mixin masonry-columns(
|
205 | $column-count,
|
206 | $gutter-size: variables.$masonry-gutter-size,
|
207 | $query: feature-targeting.all()
|
208 | ) {
|
209 | $feat-structure: feature-targeting.create-target($query, structure);
|
210 |
|
211 | @include feature-targeting.targets($feat-structure) {
|
212 | column-count: $column-count;
|
213 | column-gap: $gutter-size;
|
214 | }
|
215 |
|
216 | .mdc-image-list__item {
|
217 | @include feature-targeting.targets($feat-structure) {
|
218 | margin-bottom: $gutter-size;
|
219 | }
|
220 | }
|
221 | }
|