Zoeken...  ⌘K GitHub

ContentDivider content

Visuele scheider in verschillende stijlen: lijn, dots, gradient of label.

/content-divider
src/components/content/ContentDivider.astro
---
interface Props {
  text?: string;
  style?: "line" | "dots" | "gradient" | "label";
  spacing?: "sm" | "md" | "lg";
}

const {
  text,
  style = "line",
  spacing = "md",
} = Astro.props;
---

<div class={`cdv-wrap cdv-wrap--${spacing}`}>
  {style === "line" && !text && (
    <hr class="cdv-line" />
  )}
  {style === "gradient" && (
    <div class="cdv-gradient" role="separator" aria-hidden="true"></div>
  )}
  {style === "dots" && (
    <div class="cdv-dots" role="separator" aria-hidden="true">
      <span></span><span></span><span></span>
    </div>
  )}
  {(style === "label" || (style === "line" && text)) && text && (
    <div class="cdv-label-wrap" role="separator">
      <div class="cdv-label-line"></div>
      <span class="cdv-label-text">{text}</span>
      <div class="cdv-label-line"></div>
    </div>
  )}
</div>

<style>
  .cdv-wrap--sm { margin: 1.5rem 0; }
  .cdv-wrap--md { margin: 3rem 0; }
  .cdv-wrap--lg { margin: 5rem 0; }
  .cdv-line {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 0;
  }
  .cdv-gradient {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-accent, #6366f1), transparent);
    border-radius: 2px;
  }
  .cdv-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
  }
  .cdv-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ccc;
  }
  .cdv-label-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
  }
  .cdv-label-line {
    flex: 1;
    height: 1px;
    background: #e5e5e5;
  }
  .cdv-label-text {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #999;
    white-space: nowrap;
  }
</style>

Props

Prop Type Default Beschrijving
text string Optionele label-tekst in het midden
style 'line' | 'dots' | 'gradient' | 'label' Visuele stijl van de scheider
spacing 'sm' | 'md' | 'lg' Verticale ruimte rondom

* = verplicht