kitbash Sign in Connect agent
Components

Hazard diamond notice

A giant yellow road-sign diamond with a black inner ring holding two short notices and a Skip button with a round enter key; Skip spins the sign away and a pill brings it back.

Part of the style

Hazard Diamond Arcade

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

Preview

Code
<section class="warning" aria-label="Before you ride">
  <div class="warning__sign">
    <div class="warning__plate" aria-hidden="true"></div>
    <div class="warning__body">
      <h2 class="warning__heading">Heads up</h2>
      <p class="warning__text">Expect flashing lights, loud horns, sudden stops and a lot of spinning. If you feel dizzy or queasy, park it and take a break. Riders sensitive to strobe light should sit this round out.</p>
      <h2 class="warning__heading">House rules</h2>
      <p class="warning__text">Bump from the side, never head on. Helmets stay on until the lights go green. Every name and score on this board is made up for fun, and any likeness to a real rider is luck.</p>
      <button class="warning__skip" type="button">
        Skip
        <span class="warning__key" aria-hidden="true">
          <svg viewBox="0 0 24 24"><path d="M18 6v6.5H7M10.5 9 7 12.5l3.5 3.5" fill="none" stroke="currentColor" stroke-width="2.8" stroke-linecap="square"/></svg>
        </span>
      </button>
    </div>
  </div>
  <button class="warning__back" type="button">Read the rules again</button>
</section>

<style>
  .warning {
    --side: min(66vw, 56rem);
    position: relative;
    display: grid;
    place-items: center;
    height: clamp(40rem, 50vw, 45rem);
    overflow: hidden;
    background: var(--night);
    color: var(--ink-dark);
  }
  .warning__sign {
    position: absolute;
    left: 50%;
    top: 50%;
    translate: -50% -50%;
    display: grid;
    place-items: center;
    width: calc(var(--side) * 1.414);
    height: calc(var(--side) * 1.414);
    transition: rotate 500ms var(--ease-in-out), scale 500ms var(--ease-in-out), opacity 500ms var(--ease-in-out);
  }
  .warning__plate {
    position: absolute;
    width: var(--side);
    height: var(--side);
    rotate: 45deg;
    border-radius: 12%;
    background: var(--hazard);
  }
  .warning__plate::before,
  .warning__plate::after {
    content: "";
    position: absolute;
    inset: calc(var(--ring) * 2);
    border-radius: 10%;
    background: var(--night);
  }
  .warning__plate::after {
    inset: calc(var(--ring) * 3);
    border-radius: 9%;
    background: var(--hazard);
  }
  .warning__body {
    position: relative;
    display: grid;
    justify-items: center;
    gap: var(--space-m);
    width: min(36rem, 62%);
    text-align: center;
  }
  .warning__heading {
    margin: 0;
    font-family: var(--font-display);
    font-stretch: var(--wide);
    font-style: italic;
    font-weight: 900;
    font-size: var(--display-m);
    line-height: 1;
    text-transform: uppercase;
  }
  .warning__text {
    margin: 0 0 var(--space-m);
    font-size: var(--text-m);
    font-weight: 700;
    line-height: 1.25;
    text-wrap: balance;
  }
  .warning__skip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-s);
    min-height: 48px;
    padding: 0 0 0 var(--space-s);
    border: 0;
    background: none;
    color: var(--ink-dark);
    font: 900 var(--text-l) / 1 var(--font-display);
    font-stretch: var(--wide);
    text-transform: uppercase;
    cursor: pointer;
  }
  .warning__key {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--pill);
    background: var(--night);
    color: var(--hazard);
    transition: scale var(--quick) var(--ease);
  }
  .warning__key svg {
    width: 60%;
  }
  .warning__skip:hover .warning__key,
  .warning__skip:focus-visible .warning__key {
    scale: 1.12;
  }
  .warning__skip:active .warning__key {
    scale: 0.94;
  }
  .warning__skip:focus-visible,
  .warning__back:focus-visible {
    outline: var(--line) solid currentColor;
    outline-offset: 4px;
  }
  .warning__back {
    position: absolute;
    min-height: 44px;
    padding: 0 var(--space-l);
    border: 0;
    border-radius: var(--pill);
    background: var(--hazard);
    color: var(--ink-dark);
    font: italic 900 var(--text-s) / 1 var(--font-display);
    font-stretch: var(--wide);
    letter-spacing: var(--track);
    text-transform: uppercase;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--quick) var(--ease), visibility 0s var(--quick);
  }
  .warning.is-gone .warning__sign {
    rotate: 45deg;
    scale: 0;
    opacity: 0;
  }
  .warning.is-gone .warning__back {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--quick) var(--ease) 400ms;
  }

  /* Phones: the diamond would be too small for the words, so the sign becomes a tall plate with cut corners and the same ring. */
  @media (max-width: 47.5rem) {
    .warning {
      height: auto;
      padding: var(--section-space) var(--edge);
    }
    .warning__sign {
      position: relative;
      left: auto;
      top: auto;
      translate: none;
      width: 100%;
      height: auto;
      padding: calc(var(--ring) * 3 + 2.75rem) calc(var(--ring) * 3 + 1.25rem);
    }
    .warning__plate {
      inset: 0;
      width: auto;
      height: auto;
      rotate: none;
      border-radius: var(--radius-l);
      clip-path: polygon(14% 0, 86% 0, 100% 7%, 100% 93%, 86% 100%, 14% 100%, 0 93%, 0 7%);
    }
    .warning__plate::before,
    .warning__plate::after {
      border-radius: var(--radius-s);
      clip-path: polygon(14% 0, 86% 0, 100% 7%, 100% 93%, 86% 100%, 14% 100%, 0 93%, 0 7%);
    }
    .warning__body {
      width: 100%;
    }
    .warning__text {
      font-size: 0.8125rem;
    }
    .warning.is-gone .warning__back {
      top: 50%;
      translate: 0 -50%;
    }
  }
</style>

<script>
(() => {
  for (const root of document.querySelectorAll('.warning')) {
    const skip = root.querySelector('.warning__skip');
    const back = root.querySelector('.warning__back');
    skip.addEventListener('click', () => {
      root.classList.add('is-gone');
      setTimeout(() => back.focus({ preventScroll: true }), 450);
    });
    back.addEventListener('click', () => {
      root.classList.remove('is-gone');
      skip.focus({ preventScroll: true });
    });
  }
})();
</script>

Similar components

Wiped statement

Wiped statement

Open call

Open call

Small caps statement

Small caps statement

Black statement

Black statement

About banner

About banner

Centred statement

Centred statement

Dark ask panel

Dark ask panel

Getting there

Getting there