|
8 | 8 | }
|
9 | 9 |
|
10 | 10 | .trash-item-container {
|
11 |
| - margin: 10px 0px 0px 0px; |
12 |
| - flex: 1 1 30%; /* Each item takes 30% of the width (adjust as needed) */ |
13 |
| - max-width: 30%; |
14 |
| - box-sizing: border-box; |
| 11 | + flex: 1 1 33%; /* Each item takes 30% of the width (adjust as needed) */ |
| 12 | + max-width: 22%; |
15 | 13 | display: flex;
|
16 | 14 | flex-direction: column; /* Ensures elements inside stack vertically */
|
17 | 15 | align-items: center; /* Center items horizontally within the container */
|
18 | 16 | text-align: center; /* Ensures text aligns in the center */
|
| 17 | + |
| 18 | + margin: 0px 0px var(--homey-su-3) 0px; /* Add some spacing between items */ |
| 19 | + box-sizing: border-box; |
| 20 | + padding: var(--homey-su) var(--homey-su-2); |
| 21 | + background-color: var(--homey-background-color); |
| 22 | + border-radius: var(--homey-border-radius-default); |
| 23 | + } |
| 24 | + |
| 25 | + .trashContainer.triple .trash-item-container { |
| 26 | + flex: 1 1 33%; |
| 27 | + max-width: 31%; |
| 28 | + } |
| 29 | + |
| 30 | + .trashContainer.quad .trash-item-container { |
| 31 | + flex: 1 1 25%; |
| 32 | + max-width: 23%; |
19 | 33 | }
|
20 | 34 |
|
21 | 35 | .dot-large {
|
|
36 | 50 | }
|
37 | 51 |
|
38 | 52 | .trash-date {
|
39 |
| - margin: 0px 0px; |
40 |
| - padding: 5px 0px 0px 0px; |
| 53 | + margin: 2px 0px 0px 0px; |
| 54 | + padding: 6px 0px 0px 0px; |
41 | 55 | text-align: center;
|
42 | 56 | }
|
43 | 57 |
|
44 |
| - .trashContainer.triple .trash-item-container { |
45 |
| - flex: 1 1 24%; |
46 |
| - max-width: 324%; |
47 |
| - } |
48 |
| - |
49 |
| - .trashContainer.quad .trash-item-container { |
50 |
| - flex: 1 1 24%; |
51 |
| - max-width: 324%; |
52 |
| - } |
53 |
| - |
54 | 58 | .trash-item-container-compact {
|
55 | 59 | display: flex;
|
56 | 60 | align-items: center; /* Vertically center the dot and text */
|
57 | 61 | justify-content: flex-start; /* Align items to the left */
|
58 |
| - width: 40%; /* Each container takes about half the width */ |
59 |
| - margin: 5px 10px 0px 10px; /* Add some spacing between items */ |
| 62 | + width: 48%; /* Each container takes about half the width */ |
| 63 | + margin: 0px 0px var(--homey-su-3) 0px; /* Add some spacing between items */ |
60 | 64 | box-sizing: border-box;
|
| 65 | + padding: var(--homey-su) var(--homey-su-2); |
| 66 | + background-color: var(--homey-background-color); |
| 67 | + border-radius: var(--homey-border-radius-default); |
61 | 68 | }
|
62 | 69 |
|
63 | 70 | /* Dot styling - aligned to the left */
|
|
88 | 95 | /* Title and subtitle styling */
|
89 | 96 | .trash-date-title {
|
90 | 97 | margin: 0;
|
91 |
| - font-weight: bold; |
92 |
| - font-size: 12px; |
| 98 | + font-weight: var(--homey-font-weight-medium); |
| 99 | + font-size: var(--homey-font-size-small); |
| 100 | + line-height: var(--homey-font-size-small); |
93 | 101 | }
|
94 | 102 |
|
95 | 103 | .trash-date-subtitle {
|
|
132 | 140 | .dot-type-GLAS {
|
133 | 141 | background-color: #00cdae;
|
134 | 142 | }
|
| 143 | + |
| 144 | + .my-custom-body { |
| 145 | + background-color: transparent; |
| 146 | + overflow-x: auto; |
| 147 | + } |
135 | 148 |
|
136 | 149 | .my-custom-body-overflow-hidden {
|
| 150 | + background-color: transparent; |
137 | 151 | overflow: hidden;
|
138 | 152 | }
|
139 | 153 | </style>
|
|
188 | 202 | tbody.innerHTML = '';
|
189 | 203 | let counter = 0;
|
190 | 204 | let usedTypes = {};
|
191 |
| - let rowHeight = 80; |
| 205 | + let rowHeight = 88; |
192 | 206 | let itemsPerRow = 4;
|
193 | 207 |
|
194 | 208 | for (let index in response) {
|
|
212 | 226 | } else {
|
213 | 227 |
|
214 | 228 | const trashTypeText = Homey.__(`widgets.trashType.${trashItem.type}`);
|
215 |
| - rowHeight = 40; |
| 229 | + rowHeight = 57; |
216 | 230 | itemsPerRow = 2;
|
217 | 231 |
|
218 | 232 | tbody.innerHTML += `
|
|
226 | 240 | }
|
227 | 241 | }
|
228 | 242 |
|
229 |
| - if(widgetSetting['layout-type'] === 'large') { |
| 243 | + if(widgetSetting['layout-type'] === 'large' && counter % 3 === 0) itemsPerRow = 3; |
| 244 | + |
| 245 | + if(widgetSetting['layout-type'] === 'large' && itemsPerRow === 4) { |
| 246 | + tbody.classList.remove('triple'); |
230 | 247 | tbody.classList.add('quad');
|
231 |
| - } else { |
| 248 | + } else if(widgetSetting['layout-type'] === 'large') { |
232 | 249 | tbody.classList.remove('quad');
|
| 250 | + tbody.classList.add('triple'); |
233 | 251 | }
|
234 | 252 |
|
235 | 253 | const dBody = document.querySelector('#main-body');
|
|
241 | 259 | dBody.classList.add('my-custom-body-overflow-hidden'); // Make the widget not overflow
|
242 | 260 | }
|
243 | 261 |
|
244 |
| - Homey.ready({ height: (widgetSetting['list-height'] * rowHeight) + 10 }); |
| 262 | + Homey.ready({ height: ((widgetSetting['list-height'] * rowHeight) + (widgetSetting['list-height']-1 * 10)) }); |
245 | 263 | }).catch((error) => {
|
246 | 264 | console.error(error);
|
247 | 265 | });
|
|
0 commit comments