kitbash Sign in Connect agent
Components

Project sheet

Phone-style project: a line drawing on top, then bold category, bold title and 'Label: value' lines with an indented list; thin chevrons swap projects.

Part of the style

Shelf Atelier

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --ink: #9da4a9;
  --paper: #0a1328;
  --line: #333c4e;
  --line-soft: #1f283c;
  --scrim: rgba(157, 164, 169, 0.2);
}
</style>

<section class="project" aria-label="Projects, one at a time">
  <div class="project__view">
    <div class="project__figure">
      <svg class="project__drawing" xmlns="http://www.w3.org/2000/svg" role="img"></svg>
    </div>
    <article class="project__sheet">
      <p class="project__category"></p>
      <h2 class="project__title"></h2>
      <dl class="project__facts"></dl>
    </article>
  </div>
  <nav class="project__nav" aria-label="Other projects">
    <button class="project__step" type="button" data-step="-1" aria-label="Previous project">
      <svg width="11" height="17" viewBox="0 0 11 17" fill="none" aria-hidden="true"><path d="M9.7 1L1 8.6L9.7 16" /></svg>
    </button>
    <button class="project__step" type="button" data-step="1" aria-label="Next project">
      <svg width="11" height="17" viewBox="0 0 11 17" fill="none" aria-hidden="true"><path d="M1.3 1L10 8.6L1.3 16" /></svg>
    </button>
  </nav>
</section>

<style>
  .project {
    padding: var(--edge);
    background: var(--paper);
    color: var(--ink);
  }
  .project__view {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: end;
    gap: var(--gap) calc(var(--gap) * 2);
    transition: opacity var(--slow) var(--ease-swap);
  }
  .project.is-leaving .project__view {
    opacity: 0;
  }
  .project__figure {
    display: grid;
    place-items: center;
    min-width: 0;
  }
  .project__drawing {
    width: 100%;
    height: clamp(260px, 44vw, 480px);
    overflow: visible;
  }
  .project__drawing polygon,
  .project__drawing polyline {
    fill: var(--paper);
    stroke: var(--ink);
    stroke-width: var(--stroke);
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
  }
  .project__drawing .project__solid {
    fill: var(--ink);
    stroke: var(--paper);
  }
  .project__drawing .project__glyph {
    fill: none;
  }
  .project__sheet {
    padding-bottom: var(--space-m);
  }
  .project__category,
  .project__title {
    margin: 0;
    font-size: var(--text);
    font-weight: var(--weight-bold);
    line-height: var(--leading);
  }
  .project__title {
    margin-bottom: var(--space-m);
    text-wrap: balance;
  }
  .project__facts {
    margin: 0;
  }
  .project__facts dt {
    display: inline;
    font-weight: var(--weight-bold);
  }
  .project__facts dd {
    display: inline;
    margin: 0;
  }
  .project__facts .project__list dd {
    display: block;
    padding-left: var(--indent);
  }
  .project__nav {
    display: flex;
    justify-content: center;
    gap: var(--space-s);
    margin-top: var(--space-s);
  }
  .project__step {
    display: grid;
    place-items: center;
    width: var(--tap);
    height: var(--tap);
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
    transition: translate var(--quick) var(--ease);
  }
  .project__step path {
    stroke: currentColor;
    stroke-width: var(--hair);
  }
  .project__step[data-step="-1"]:hover {
    translate: -3px 0;
  }
  .project__step[data-step="1"]:hover {
    translate: 3px 0;
  }
  .project__step:focus-visible {
    outline: var(--hair) solid var(--ink);
  }

  @media (max-width: 760px) {
    .project__view {
      grid-template-columns: minmax(0, 1fr);
    }
    .project__drawing {
      height: clamp(260px, 80vw, 420px);
    }
  }
</style>

<script>
  (() => {
    const NS = 'http://www.w3.org/2000/svg';
    const SWAP_MS = 550;
    const COS30 = Math.cos(Math.PI / 6);
    const project = ([x, y, z]) => [(x - y) * COS30, (x + y) * 0.5 - z];
    const pointsOf = (corners) => corners.map((corner) => project(corner).map((n) => n.toFixed(2)).join(',')).join(' ');
    const shape = (tag, corners, className) => {
      const node = document.createElementNS(NS, tag);
      node.setAttribute('points', pointsOf(corners));
      if (className) node.setAttribute('class', className);
      return node;
    };
    const face = (corners, className) => shape('polygon', corners, className);
    const box = (x, y, z, w, d, h, className) => [
      face([[x + w, y, z], [x + w, y + d, z], [x + w, y + d, z + h], [x + w, y, z + h]], className),
      face([[x, y + d, z], [x + w, y + d, z], [x + w, y + d, z + h], [x, y + d, z + h]], className),
      face([[x, y, z + h], [x + w, y, z + h], [x + w, y + d, z + h], [x, y + d, z + h]], className),
    ];
    const backToFront = (boxes) => boxes.sort((a, b) => a[0] + a[1] + a[2] - (b[0] + b[1] + b[2])).flatMap((b) => box(...b));
    const legs = (x, y, z, w, d, size) => [[x, y], [x + w - size, y], [x, y + d - size], [x + w - size, y + d - size]]
      .map(([lx, ly]) => [lx, ly, 0, size, size, z]);
    const gable = (x, y, z, w, d, h, roof) => [
      ...box(x, y, z, w, d, h).slice(0, 2),
      face([[x, y, z + h], [x + w, y, z + h], [x + w, y + d / 2, z + h + roof], [x, y + d / 2, z + h + roof]]),
      face([[x, y + d, z + h], [x + w, y + d, z + h], [x + w, y + d / 2, z + h + roof], [x, y + d / 2, z + h + roof]]),
      face([[x + w, y, z + h], [x + w, y + d, z + h], [x + w, y + d / 2, z + h + roof]]),
    ];

    /* A frame leaning on something: u runs along x, v climbs the lean. Draws the small "_m" on its face. */
    function leaningFrame(x0, y0, width, lean) {
      const at = (u, v) => [x0 + u, y0 - lean.back * v, lean.up * v];
      const glyph = (points) => shape('polyline', points.map(([u, v]) => at(u, v)), 'project__glyph');
      return [
        face([at(0, 0), at(width, 0), at(width, 1), at(0, 1)]),
        face([at(4, 0.04), at(width - 4, 0.04), at(width - 4, 0.96), at(4, 0.96)]),
        glyph([[width * 0.4, 0.27], [width * 0.54, 0.27]]),
        glyph([[width * 0.58, 0.3], [width * 0.58, 0.44], [width * 0.66, 0.44], [width * 0.66, 0.3], [width * 0.66, 0.44], [width * 0.74, 0.44], [width * 0.74, 0.3]]),
      ];
    }

    const PROJECTS = [
      {
        category: 'TEACHING',
        title: 'Shelves. Small rooms for large ideas',
        facts: [
          ['Subject:', 'Furniture as Architecture'],
          ['Tutors:', 'Inés Ojeda / Pieter Brandt'],
          ['School:', 'Studio of the Small Object, Valencia'],
          ['Selected students:', ['Marta Llobet_A Table for Waiting', 'Joris Peeters_Twelve Drawers', 'Aitana Sanz_The Leaning Room', 'Omar Haddad_Books as Walls']],
        ],
        label: 'Line drawing of a table with stacked books and a frame leaning on it',
        draw: () => [
          ...backToFront(legs(0, 0, 60, 120, 56, 2)),
          ...box(0, 0, 60, 120, 56, 3),
          ...backToFront([[8, 10, 63, 46, 34, 5], [12, 12, 68, 38, 30, 6], [10, 14, 74, 42, 26, 4], [18, 16, 78, 26, 20, 8]]),
          ...[0, 1, 2, 3, 4].flatMap((layer) => box(64 + layer, 12 - layer, 63 + layer * 2, 40, 30, 2, 'project__solid')),
          ...leaningFrame(78, 96, 62, { back: 38, up: 112 }),
        ],
      },
      {
        category: 'HOUSING',
        title: 'Casa Ribera. A house for two families and one long table',
        facts: [
          ['Client:', 'Cooperativa La Séquia'],
          ['Location:', 'Ribera Alta (ES)'],
          ['Status:', 'Under construction'],
          ['Team:', ['Inés Ojeda', 'Pieter Brandt', 'Lucía Ferrer_structure']],
          ['Year:', '2024'],
        ],
        label: 'Line drawing of a stool holding a model house',
        draw: () => [
          ...backToFront(legs(20, 10, 46, 52, 52, 3)),
          ...box(20, 10, 46, 52, 52, 3),
          ...gable(26, 22, 49, 40, 22, 18, 12),
          ...box(30, 50, 49, 30, 8, 1),
          ...box(96, 40, 0, 10, 10, 24),
          ...box(94, 38, 24, 14, 14, 12, 'project__solid'),
        ],
      },
      {
        category: 'COMPETITION',
        title: 'Torre Lenta. A tower that grows one floor a year',
        facts: [
          ['Brief:', 'Archive for a town of 4,000'],
          ['Location:', 'Ostend (BE)'],
          ['Status:', 'Second prize'],
          ['Size:', 'XL'],
          ['Jury notes:', ['Patient', 'Too quiet for a tower', 'Quiet on purpose']],
        ],
        label: 'Line drawing of a plinth carrying a stepped tower model and a small figure',
        draw: () => [
          ...box(10, 10, 0, 70, 70, 44),
          ...backToFront([[22, 22, 44, 44, 44, 20], [28, 28, 64, 32, 32, 24], [34, 34, 88, 20, 20, 30], [38, 38, 118, 12, 12, 26]]),
          ...box(40, 40, 144, 8, 8, 4, 'project__solid'),
          ...box(96, 70, 0, 4, 3, 18),
        ],
      },
    ];

    function renderFacts(list, facts) {
      list.replaceChildren(...facts.map(([label, value]) => {
        const row = document.createElement('div');
        const term = document.createElement('dt');
        term.textContent = label;
        row.append(term);
        const values = Array.isArray(value) ? value : [value];
        if (Array.isArray(value)) row.className = 'project__list';
        else row.append(' ');
        for (const text of values) {
          const item = document.createElement('dd');
          item.textContent = text;
          row.append(item);
        }
        return row;
      }));
    }

    function render(root, entry) {
      const svg = root.querySelector('.project__drawing');
      svg.removeAttribute('viewBox');
      svg.replaceChildren(...entry.draw());
      svg.setAttribute('aria-label', entry.label);
      const bounds = svg.getBBox();
      svg.setAttribute('viewBox', `${bounds.x - 4} ${bounds.y - 4} ${bounds.width + 8} ${bounds.height + 8}`);
      root.querySelector('.project__category').textContent = entry.category;
      root.querySelector('.project__title').textContent = entry.title;
      renderFacts(root.querySelector('.project__facts'), entry.facts);
    }

    function setUp(root) {
      const still = matchMedia('(prefers-reduced-motion: reduce)');
      let current = 0;
      let busy = false;
      render(root, PROJECTS[current]);

      root.querySelectorAll('.project__step').forEach((button) => {
        button.addEventListener('click', () => {
          if (busy) return;
          current = (current + Number(button.dataset.step) + PROJECTS.length) % PROJECTS.length;
          if (still.matches) return render(root, PROJECTS[current]);
          busy = true;
          root.classList.add('is-leaving');
          setTimeout(() => {
            render(root, PROJECTS[current]);
            root.classList.remove('is-leaving');
            busy = false;
          }, SWAP_MS);
        });
      });
    }

    document.querySelectorAll('.project').forEach(setUp);
  })();
</script>

Similar components

Project chapter

Project chapter

Small caps statement

Small caps statement

Black statement

Black statement

Red flood studio

Red flood studio

Case study flood

Case study flood

Discipline shapes

Discipline shapes

Big statement

Big statement

Ruled columns

Ruled columns