Skip to content

Commit 30a54f3

Browse files
committed
Fix spotlight tile regressions
The buttons were scrolling with the view instead of always being visible in a fixed location on the tile, and the indicators were not adopting the correct width.
1 parent 66b79f5 commit 30a54f3

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

src/tile/SpotlightTile.module.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
.tile {
17+
.contents {
18+
block-size: 100%;
19+
inline-size: 100%;
1820
display: flex;
1921
border-radius: var(--cpd-space-6x);
2022
contain: strict;
@@ -29,7 +31,7 @@ limitations under the License.
2931
scroll-behavior: smooth; */
3032
}
3133

32-
.tile.maximised {
34+
.tile.maximised .contents {
3335
border-radius: 0;
3436
}
3537

@@ -153,7 +155,7 @@ limitations under the License.
153155
}
154156

155157
.indicators > .item {
156-
inline-size: 32px;
158+
flex-basis: 32px;
157159
block-size: 2px;
158160
transition: background-color ease 0.15s;
159161
}

src/tile/SpotlightTile.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,18 @@ export const SpotlightTile = forwardRef<HTMLDivElement, Props>(
272272
<ChevronLeftIcon aria-hidden width={24} height={24} />
273273
</button>
274274
)}
275-
{vms.map((vm) => (
276-
<SpotlightItem
277-
key={vm.id}
278-
vm={vm}
279-
targetWidth={targetWidth}
280-
targetHeight={targetHeight}
281-
intersectionObserver={intersectionObserver}
282-
snap={scrollToId === null || scrollToId === vm.id}
283-
/>
284-
))}
275+
<div className={styles.contents}>
276+
{vms.map((vm) => (
277+
<SpotlightItem
278+
key={vm.id}
279+
vm={vm}
280+
targetWidth={targetWidth}
281+
targetHeight={targetHeight}
282+
intersectionObserver={intersectionObserver}
283+
snap={scrollToId === null || scrollToId === vm.id}
284+
/>
285+
))}
286+
</div>
285287
{onToggleExpanded && (
286288
<button
287289
className={classNames(styles.expand)}
@@ -311,7 +313,11 @@ export const SpotlightTile = forwardRef<HTMLDivElement, Props>(
311313
})}
312314
>
313315
{vms.map((vm) => (
314-
<div className={styles.item} data-visible={vm.id === visibleId} />
316+
<div
317+
key={vm.id}
318+
className={styles.item}
319+
data-visible={vm.id === visibleId}
320+
/>
315321
))}
316322
</div>
317323
)}

0 commit comments

Comments
 (0)