Theme
Design your own
On this page (4)
Component Skill — components/press-item/component-skill.md

Native basis

An <article>: the publication and a <time>, an optional <blockquote>, and the headline as an external link (target="_blank" rel="noopener") that covers the card.

Web Platform APIs

<article><time><blockquote>:has()

Classes

.mk-press-item.mk-press-item-title.mk-press-item-meta.mk-press-item-publication.mk-press-item-quote.mk-press-item-more

Data attributes

data-variant="quote", data-variant="compact".

§Cards

Default cards: the outlet and date, the headline - an external link covering the card, with a new-tab hint for screen readers - and a "Read on …" cue.

§Quotes

data-variant='quote': one sentence from the article leads in the serif face; the headline becomes the source line.

§Compact list

data-variant='compact': outlet, headline and date on one row - for a long press archive.

§CSS view file

/* -- Press Item (website · Company) ---------------------------------------
   Links to one external media mention with publication metadata - the outlet, the date and the headline, a pull quote, or a compact list row. */
@layer components {
  /* every box in the block measures border-box - the same on any page */
  :where(.mk-press-item, .mk-press-item *, .mk-press-item ::before, .mk-press-item ::after) {
    box-sizing: border-box;
  }
  .mk-press-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--card);
    color: var(--card-foreground);
    transition: border-color 150ms ease;
    &:hover {
      border-color: color-mix(in oklch, var(--foreground) 25%, var(--border));
    }
  }
  .mk-press-item {
    position: relative;
  }
  .mk-press-item-title a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
  }
  .mk-press-item-title a:focus-visible {
    outline: none;
  }
  .mk-press-item:has(.mk-press-item-title a:focus-visible) {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
  }
  /* zero specificity: any block rule may still position its controls */
  :where(.mk-press-item :is(button, input, select, label, .btn):not(.mk-press-item-title a)) {
    position: relative;
    z-index: 1;
  }
  .mk-press-item-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted-foreground);
    font-size: 0.8125rem;
  }
  .mk-press-item-publication {
    color: var(--foreground);
    font-size: 1.0625rem;
    font-weight: 800;
    letter-spacing: -0.02em;
  }
  .mk-press-item-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.35;
    text-wrap: balance;
    & a {
      color: inherit;
      text-decoration: none;
    }
  }
  .mk-press-item-quote {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 1.45;
    text-wrap: pretty;
    & p {
      margin: 0;
    }
    & p::before {
      content: "“";
    }
    & p::after {
      content: "”";
    }
  }
  .mk-press-item-more {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-block-start: auto;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    & svg {
      width: 0.875rem;
      height: 0.875rem;
    }
  }
  .mk-press-item[data-variant="quote"] {
    & .mk-press-item-title {
      order: 3;
      color: var(--muted-foreground);
      font-size: 0.875rem;
      font-weight: 500;
    }
    & .mk-press-item-more {
      order: 4;
    }
  }
  .mk-press-item[data-variant="compact"] {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 1rem;
    padding: 1rem 0.5rem;
    border-width: 0 0 1px;
    border-radius: 0;
    background: transparent;
    & .mk-press-item-meta {
      display: contents;
    }
    & time {
      grid-column: 3;
      grid-row: 1;
    }
    & .mk-press-item-title {
      grid-column: 2;
      grid-row: 1;
      font-size: 1rem;
    }
    & .mk-press-item-more {
      display: none;
    }
  }
  /* -- Accessibility ------------------------------------------- */
  @media (prefers-reduced-motion: reduce) {
    .mk-press-item {
      transition: none;
    }
  }
  @media (forced-colors: active) {
    .mk-press-item {
      border-color: CanvasText;
    }
  }
}

Comments, ideas or improvements? Edit this page's source on GitHub