Zoeken...  ⌘K GitHub

ListTimeline list

Verticale tijdlijn met datum, connector-dot en beschrijving per item. Geschikt voor bedrijfsgeschiedenis of mijlpalen. Light of dark.

/list-timeline
src/components/list/ListTimeline.astro
---
/**
 * ListTimeline
 * Verticale tijdlijn met datum/jaar, connector-dot en beschrijving per item.
 * Geschikt voor bedrijfsgeschiedenis, proces-stappen of mijlpalen.
 *
 * Props:
 * - items: Array<{ date: string; title: string; desc?: string }>
 * - theme?: 'light' | 'dark'   default 'light'
 */
interface Props {
  items: { date: string; title: string; desc?: string }[];
  theme?: 'light' | 'dark';
}

const {
  items,
  theme = 'light',
} = Astro.props;
---

<section class:list={['bl-section', 'lst-tl-section', `lst-tl-section--${theme}`]}>
  <div class="bl-inner bl-inner--narrow">
    <div class="lst-tl">
      {items.map(({ date, title, desc }) => (
        <div class="lst-tl__item">
          <div class="lst-tl__aside">
            <span class="lst-tl__date">{date}</span>
            <div class="lst-tl__connector">
              <div class="lst-tl__dot"></div>
              <div class="lst-tl__line"></div>
            </div>
          </div>
          <div class="lst-tl__body">
            <strong class="lst-tl__title">{title}</strong>
            {desc && <p class="lst-tl__desc">{desc}</p>}
          </div>
        </div>
      ))}
    </div>
  </div>
</section>

<style>
.lst-tl-section--dark { background: #0a0a0a; }

.lst-tl {
  display: flex;
  flex-direction: column;
}

.lst-tl__item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1rem;
  position: relative;
}

.lst-tl__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  position: relative;
}

.lst-tl__date {
  font-size: .8rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: .04em;
  padding-top: .1rem;
}

.lst-tl-section--dark .lst-tl__date {
  color: var(--color-accent);
}

.lst-tl__connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  gap: 0;
  position: absolute;
  right: -1rem;
  top: .5rem;
  bottom: 0;
}

.lst-tl__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
}

.lst-tl__line {
  width: 2px;
  flex: 1;
  background: #e5e5e5;
  min-height: 1rem;
}

.lst-tl-section--dark .lst-tl__line {
  background: #333;
}

.lst-tl__item:last-child .lst-tl__line { display: none; }

.lst-tl__body {
  padding-bottom: 1.75rem;
  padding-left: .5rem;
}

.lst-tl__title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary, #0a0a0a);
  margin-bottom: .2rem;
}

.lst-tl-section--dark .lst-tl__title {
  color: #e8e8e8;
}

.lst-tl__desc {
  margin: 0;
  font-size: .9rem;
  color: #555;
  line-height: 1.55;
}

.lst-tl-section--dark .lst-tl__desc {
  color: #aaa;
}
</style>

Props

Prop Type Default Beschrijving
items * Array<{ date: string; title: string; desc?: string }> - Tijdlijn-items: datum, titel en optionele beschrijving
theme 'light' | 'dark' 'light' Achtergrond-mode

* = verplicht