kitbash Sign in Connect agent
Components

Pixel atlas

The signature: an orange pixel map that builds on load, white story cards floating over it and an accordion of places that lights each region yellow.

Part of the style

Pixel Map Yellow

7 parts that belong together, with their tokens, type and rules.

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --paper: #e9e9e9;
  --ink: #363736;
  --white: #434343;
  --field: #e2e2e2;
  --ink-soft: rgba(54, 55, 54, 0.6);
  --flame: #4bb299;
  --sun: #4bb299;
  --sun-pale: #6ab39f;
  --sea: #4bb299;
  --sky: #4bb299;
}
</style>

<section class="atlas">
  <p class="atlas__label">Villages with residencies</p>
  <div class="atlas__body">
    <div class="atlas__stage">
      <svg class="atlas__map" shape-rendering="crispEdges" viewBox="0 0 920 400" role="img" aria-label="Pixel map of the valley, three village areas" data-active="c"
        data-mask="
...........................a.....................
..................a........a........b............
..................aa..............bbb.......c.....
...........aa....aaa.............bbbb.....ccc.....
..........aaa..aaaaaa......b....bbbbb....cccc.....
....aaa.aaaaaaaaaaaaa.....bbb..bbbbbb...cccccc....
...aaaaaaaaaaaaaaaaaaa...bbbbbbbbbbbb..ccccccc....
..aaaaaa.aaaaaaaaaaaaa..bbbbbbbbbbbbbbccccccccc...
.aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbcccccccccc.
aaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbccccccccc.
aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbcccccc..
.aaaa..aaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbccccc....
..aa...aaaaaaa.aaa..bbbbbbbbbbbbbbbbbbbbbbcccc....
.......aaaa....a.....bbbbbbbbbbbbbbbbbbbbbccc.....
.......aa.............bbbbbbbbbb.bbbbbbbbbcc......
.......................bbbbbbbbb..bbbbbbb.........
........................bbb.bbbb...bbbb...........
.........................b...bbb....bb............
..............................b...................
"><g class="atlas__cells"></g></svg>
      <ul class="atlas__cards">
        <li class="atlas__card">
          <a class="atlas__card-link" href="#">
            <img class="atlas__card-img" src="assets/trimmers.jpg" alt="A small tractor far off in rows of green vines under a blue sky" width="800" height="450">
            <span class="atlas__card-title">Rows at noon</span>
            <span class="atlas__card-who">Inês Lameira</span>
          </a>
        </li>
        <li class="atlas__card">
          <a class="atlas__card-link" href="#">
            <img class="atlas__card-img" style="object-position: 20% 50%" src="assets/stonehouse.jpg" alt="An old photograph of villagers gathered on and around a stone building" width="800" height="587">
            <span class="atlas__card-title">Listening session at the old cistern</span>
            <span class="atlas__card-who">Tomás Ferraz</span>
          </a>
        </li>
        <li class="atlas__card">
          <a class="atlas__card-link" href="#">
            <img class="atlas__card-img" src="assets/vines.jpg" alt="A hill of vines with a windmill and farmhouse on the crest" width="800" height="450">
            <span class="atlas__card-title">Valdorna at the Harvest Fair</span>
            <span class="atlas__card-who">Inês Lameira, Tomás Ferraz, Rui Basto</span>
          </a>
        </li>
      </ul>
    </div>

    <div class="atlas__places">
      <div class="atlas__place" data-region="a">
        <h3 class="atlas__heading">
          <button class="atlas__trigger" type="button" aria-expanded="false" aria-controls="atlas-panel-a" id="atlas-trigger-a">
            <span class="atlas__name">Pedralva</span>
            <svg class="atlas__chevron" viewBox="0 0 24 14" aria-hidden="true"><path d="M1 1l11 11L23 1"/></svg>
          </button>
        </h3>
        <div class="atlas__panel" id="atlas-panel-a" role="region" aria-labelledby="atlas-trigger-a">
          <div class="atlas__inner">
            <p class="atlas__role">Resident</p>
            <p class="atlas__who">Rui Basto</p>
            <a class="atlas__more" href="#">Know more</a>
          </div>
        </div>
      </div>
      <div class="atlas__place" data-region="b">
        <h3 class="atlas__heading">
          <button class="atlas__trigger" type="button" aria-expanded="false" aria-controls="atlas-panel-b" id="atlas-trigger-b">
            <span class="atlas__name">Ouriço Alto</span>
            <svg class="atlas__chevron" viewBox="0 0 24 14" aria-hidden="true"><path d="M1 1l11 11L23 1"/></svg>
          </button>
        </h3>
        <div class="atlas__panel" id="atlas-panel-b" role="region" aria-labelledby="atlas-trigger-b">
          <div class="atlas__inner">
            <p class="atlas__role">Resident</p>
            <p class="atlas__who">Tomás Ferraz</p>
            <a class="atlas__more" href="#">Know more</a>
          </div>
        </div>
      </div>
      <div class="atlas__place is-open" data-region="c">
        <h3 class="atlas__heading">
          <button class="atlas__trigger" type="button" aria-expanded="true" aria-controls="atlas-panel-c" id="atlas-trigger-c">
            <span class="atlas__name">Lameiras</span>
            <svg class="atlas__chevron" viewBox="0 0 24 14" aria-hidden="true"><path d="M1 1l11 11L23 1"/></svg>
          </button>
        </h3>
        <div class="atlas__panel" id="atlas-panel-c" role="region" aria-labelledby="atlas-trigger-c">
          <div class="atlas__inner">
            <p class="atlas__role">Resident</p>
            <p class="atlas__who">Inês Lameira</p>
            <a class="atlas__more" href="#">Know more</a>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

<style>
  .atlas {
    padding: var(--section-space) var(--edge);
    background: var(--paper);
    color: var(--ink);
  }
  .atlas__label {
    margin: 0 0 var(--space-m);
    font-size: var(--text-xs);
    line-height: var(--leading-tight);
    text-transform: uppercase;
  }
  .atlas__body {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
    gap: var(--space-l);
    align-items: start;
  }
  .atlas__stage {
    position: relative;
    padding-top: clamp(40px, 6vw, 90px);
  }
  .atlas__map {
    width: 100%;
    height: auto;
    overflow: visible;
  }
  .atlas__cell {
    fill: var(--flame);
    cursor: pointer;
    transform-box: fill-box;
    transform-origin: center;
    transition: fill var(--fill-time) ease;
    animation: atlas-cell 240ms var(--ease) both;
  }
  .atlas__map[data-active="a"] .atlas__cell[data-region="a"],
  .atlas__map[data-active="b"] .atlas__cell[data-region="b"],
  .atlas__map[data-active="c"] .atlas__cell[data-region="c"] {
    fill: var(--sun);
  }
  .atlas__map[data-hover="a"] .atlas__cell[data-region="a"],
  .atlas__map[data-hover="b"] .atlas__cell[data-region="b"],
  .atlas__map[data-hover="c"] .atlas__cell[data-region="c"] {
    fill: var(--ink);
  }
  @keyframes atlas-cell {
    from { opacity: 0; transform: scale(0.4); }
    to { opacity: 1; transform: none; }
  }

  .atlas__cards {
    position: absolute;
    top: 0;
    left: 34%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-s);
    width: 56%;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .atlas__card {
    background: var(--white);
    box-shadow: var(--shadow-card);
  }
  .atlas__card-link {
    display: grid;
    align-content: start;
    gap: 2px;
    height: 100%;
    padding: var(--space-s) var(--space-s) var(--space-m);
    color: var(--ink);
    font-size: var(--text-xs);
    line-height: var(--leading-tight);
    text-decoration: none;
  }
  .atlas__card-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin-bottom: var(--space-s);
    object-fit: cover;
    transition: opacity var(--quick) var(--ease);
  }
  .atlas__card-link:hover .atlas__card-img,
  .atlas__card-link:focus-visible .atlas__card-img {
    opacity: 0.85;
  }
  .atlas__card-link:hover .atlas__card-title,
  .atlas__card-link:focus-visible .atlas__card-title {
    color: var(--flame);
  }
  .atlas__card-link:focus-visible {
    outline: var(--rule) solid var(--flame);
    outline-offset: -4px;
  }
  .atlas__card-title { transition: color var(--quick) var(--ease); }

  .atlas__places {
    border-top: var(--rule) var(--rule-style) var(--ink);
  }
  .atlas__place {
    border-bottom: var(--rule) var(--rule-style) var(--ink);
  }
  .atlas__heading {
    margin: 0;
    font: inherit;
  }
  .atlas__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-m);
    width: 100%;
    min-height: 52px;
    padding: var(--space-s) 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: 400 var(--text-xl)/var(--leading-tight) var(--font-body);
    text-align: left;
    cursor: pointer;
    transition: color var(--quick) var(--ease);
  }
  .atlas__trigger:hover,
  .atlas__trigger:focus-visible {
    color: var(--flame);
  }
  .atlas__trigger:focus-visible {
    outline: var(--rule) solid var(--flame);
    outline-offset: 2px;
  }
  .atlas__chevron {
    flex: none;
    width: 24px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.2;
    transition: transform calc(var(--slow) / 3) var(--ease);
  }
  .atlas__place.is-open .atlas__chevron { transform: rotate(180deg); }
  .atlas__panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows calc(var(--slow) / 2) var(--ease);
  }
  .atlas__place.is-open .atlas__panel { grid-template-rows: 1fr; }
  .atlas__inner {
    min-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: visibility 0s linear calc(var(--slow) / 2);
  }
  .atlas__place.is-open .atlas__inner {
    visibility: visible;
    transition-delay: 0s;
  }
  .atlas__role {
    margin: var(--space-m) 0 var(--space-xs);
    font-size: var(--text-xs);
  }
  .atlas__who {
    margin: 0 0 var(--space-l);
    font-size: var(--text-s);
  }
  .atlas__more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 158px;
    min-height: var(--button-h);
    margin-bottom: var(--space-m);
    padding: 0 var(--space-m);
    border-radius: var(--radius);
    background: var(--flame);
    color: var(--white);
    font-size: var(--text-xs);
    text-decoration: none;
    text-transform: uppercase;
    transition: background-color var(--quick) var(--ease);
  }
  .atlas__more:hover,
  .atlas__more:focus-visible { background: var(--ink); }

  @media (max-width: 56rem) {
    .atlas__body { grid-template-columns: minmax(0, 1fr); }
    .atlas__stage {
      display: flex;
      flex-direction: column-reverse;
      gap: var(--space-l);
      padding-top: 0;
    }
    .atlas__cards {
      position: static;
      grid-template-columns: repeat(3, minmax(150px, 1fr));
      width: auto;
      overflow-x: auto;
      scroll-snap-type: x mandatory;
      padding-bottom: var(--space-s);
    }
    .atlas__card { scroll-snap-align: start; }
    .atlas__more { width: 100%; }
  }

  @media (prefers-reduced-motion: reduce) {
    .atlas__cell { animation: none; }
  }
</style>

<script>
  (() => {
    const NS = "http://www.w3.org/2000/svg";
    document.querySelectorAll(".atlas").forEach((root) => {
      const map = root.querySelector(".atlas__map");
      const group = root.querySelector(".atlas__cells");
      const places = [...root.querySelectorAll(".atlas__place")];
      if (!map || !group) return;

      const rows = map.dataset.mask.split("\n").map((r) => r.trim()).filter(Boolean);
      const size = 20;
      const width = Math.max(...rows.map((r) => r.length)) * size;
      map.setAttribute("viewBox", `0 0 ${width} ${rows.length * size}`);
      let seed = 7;
      const random = () => ((seed = (seed * 9301 + 49297) % 233280) / 233280);
      rows.forEach((row, y) => {
        [...row].forEach((ch, x) => {
          if (ch === ".") return;
          const cell = document.createElementNS(NS, "rect");
          cell.setAttribute("class", "atlas__cell");
          cell.setAttribute("x", x * size);
          cell.setAttribute("y", y * size);
          cell.setAttribute("width", size + 1);
          cell.setAttribute("height", size + 1);
          cell.dataset.region = ch;
          // Build from the bottom up with scatter, as if the land were being filled in.
          const delay = Math.round(((rows.length - y) / rows.length) * 700 + random() * 500);
          cell.style.animationDelay = `${delay}ms`;
          group.appendChild(cell);
        });
      });

      const open = (region) => {
        places.forEach((place) => {
          const on = place.dataset.region === region;
          place.classList.toggle("is-open", on);
          place.querySelector(".atlas__trigger").setAttribute("aria-expanded", String(on));
        });
        map.dataset.active = region || "";
        map.dataset.hover = "";
      };
      places.forEach((place) => {
        place.querySelector(".atlas__trigger").addEventListener("click", () => {
          open(place.classList.contains("is-open") ? null : place.dataset.region);
        });
        place.addEventListener("mouseenter", () => {
          if (place.dataset.region !== map.dataset.active) map.dataset.hover = place.dataset.region;
        });
        place.addEventListener("mouseleave", () => { map.dataset.hover = ""; });
      });
      group.addEventListener("click", (event) => {
        const region = event.target.dataset && event.target.dataset.region;
        if (region) open(region);
      });
      group.addEventListener("mouseover", (event) => {
        const region = event.target.dataset && event.target.dataset.region;
        if (region && region !== map.dataset.active) map.dataset.hover = region;
      });
      group.addEventListener("mouseleave", () => { map.dataset.hover = ""; });
    });
  })();
</script>

Similar components

Ray fan diagram

Ray fan diagram

Exploded figure with parts list

Exploded figure with parts list

Spectrum figure

Spectrum figure

Wireframe globe

Wireframe globe

Principles field

Principles field

Numbered questions

Numbered questions

Before you come

Before you come

Wallet sheet

Wallet sheet