browser/components/shopping/content/recommended-ad.css

Propagation: 53.85%

Back to Home

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

:host {
  --rec-content-gap: var(--space-medium);
}

#recommended-ad-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-small);
  text-decoration: none;
  color: var(--in-content-text-color);
}

#recommended-ad-wrapper:hover {
  cursor: pointer;
}

#recommended-ad-wrapper:hover #ad-title {
  text-decoration: underline;
  color: var(--link-color-hover);
}

#recommended-ad-wrapper:focus-visible {
  outline-offset: 4px;
  border-radius: 1px;
}

#ad-content {
  display: flex;
  justify-content: space-between;
  gap: var(--rec-content-gap);
  height: 80px;
}

#ad-letter-wrapper {
  display: flex;
  justify-content: space-between;
  flex: 1;
  gap: var(--rec-content-gap);
}

#ad-preview-image {
  max-width: 80px;
  max-height: 80px;
}

#ad-title {
  overflow: hidden;
  text-overflow: ellipsis;
  height: fit-content;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  /* This text won't be localized and when in RTL, the ellipsis is positioned
     awkwardly so we are forcing LTR */
  direction: ltr;
}

#price {
  font-size: 1em;
  font-weight: 600;
}

#footer {
  display: flex;
  align-self: end;

  &.has-price {
    justify-content: space-between;
    align-self: unset;
  }
}

#sponsored-label {
  font-size: var(--font-size-small);
  margin-block-start: 8px;
  color: var(--text-color-deemphasized);
}

/**
 * Render responsive UI for smaller sidebar widths. CSS variables are not supported
 * in media queries, so we'll hardcode the units in the calculation.
 *
 * 270px: min width for the card component needed before switching to another layout.
 * 12px: gap between product image, product name, letter grade (see --rec-content-gap). Since we can't use vars, approximate to 12px instead.
 */
@media (width < calc(270px + 12px)) {
  #ad-content {
    flex-direction: column;
    height: revert;
  }

  #ad-letter-wrapper {
    flex-direction: column-reverse;
  }

  #footer {
    align-self: start;
    gap: var(--space-small);
    flex-direction: column;
  }
}
Back to Home