<style include="common">
:host {
-webkit-tap-highlight-color: transparent;
box-sizing: border-box;
cursor: pointer;
overflow: hidden;
padding: calc(var(--personalization-app-grid-item-spacing) / 2);
/* Subtract 0.34px to fix subpixel rounding issues with iron-list. This
* ensures all grid items in a row add up to at least 1px smaller than the
* parent width. */
width: calc(100% / 3 - 0.34px);
}
@media(min-width: 720px) {
:host {
width: calc(100% / 4 - 0.25px);
}
}
:host(:focus-visible) {
outline: none;
}
.item {
align-items: center;
background-color: rgba(0, 0, 0, 0.12);
border-radius: var(--personalization-app-grid-item-border-radius);
box-sizing: border-box;
display: flex;
flex-direction: column;
height: 120px;
justify-content: center;
overflow: hidden;
position: relative;
width: 100%;
}
:host(:focus-visible) .item {
outline: 2px solid var(--cros-focus-ring-color);
}
:host([aria-checked='true']) .item {
background-color: var(--cros-sys-highlight_shape, rgba(
var(--cros-color-prominent-rgb),
var(--personalization-app-second-tone-opacity)));
border-radius:
calc(var(--personalization-app-grid-item-border-radius) + 4px);
}
img {
border-radius: var(--personalization-app-grid-item-border-radius);
height: 100%;
object-fit: cover;
width: 100%;
}
:host([aria-checked='true']) .item img {
animation-duration: 200ms;
animation-fill-mode: forwards;
animation-name: img-resize;
animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1.0);
}
@keyframes img-resize {
100% {
height: calc(100% - 8px);
width: calc(100% - 8px);
}
}
.text {
color: var(--cros-text-color-secondary);
display: flex;
flex-direction: column;
font: var(--cros-body-2-font);
margin: 8px 0 0 0;
}
iron-icon {
--iron-icon-height: 20px;
--iron-icon-width: 20px;
animation-duration: 200ms;
animation-name: iron-icon-scale;
animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1.0);
left: 8px;
position: absolute;
top: 8px;
}
:host(:not([aria-checked='true'])) .item iron-icon {
display: none;
}
@keyframes iron-icon-scale {
from {
transform: scale(0);
}
to {
transform: scale(1);
}
}
</style>
<div class="item">
<img is="cr-auto-img" auto-src="[[imgSrc_]]"></img>
<iron-icon icon="personalization-shared:circle-checkmark"></iron-icon>
</div>
<p class="text" title$="[[itemDescription_]]">[[itemDescription_]]</p>