---
import Icon from '@ui/Icon.astro'
import DocsLogo from './DocsLogo.astro'
import { site } from '@shared/lib/site'

// Eventually belongs in src/lib/site.ts (out of scope for this task).
const previewUrl = 'https://preview.tabler.io'
const changelogUrl = 'https://tabler.io/changelog'
---

<!-- BEGIN DOCS NAVBAR -->
<div class="navbar navbar-expand sticky-top">
  <div class="container">
    <div class="row flex-fill align-items-md-center">
      <div class="col">
        <div class="d-flex align-items-center gap-4">
          {/* href="." — relative link for docs root */}
          <a href="." class="navbar-brand navbar-brand-autodark gap-4">
            <DocsLogo />
          </a>
          <div>
            <span class="badge">v{site.version}</span>
          </div>
        </div>
      </div>
      <div class="d-none d-md-block col">
        <div id="docsearch"></div>
      </div>
      <div class="col d-flex">
        <ul class="navbar-nav ms-auto gap-2 align-items-center">
          <div class="nav-item d-none d-md-block">
            <a href={previewUrl} class="nav-link">Preview</a>
          </div>
          <div class="nav-item d-none d-md-block">
            <a href={changelogUrl} class="nav-link">Changelog</a>
          </div>
          <li class="nav-item hide-theme-dark">
            <a href="?theme=dark" class="btn btn-icon">
              <Icon name="moon" />
            </a>
          </li>
          <li class="nav-item hide-theme-light">
            <a href="?theme=light" class="btn btn-icon">
              <Icon name="sun" />
            </a>
          </li>
          <li class="nav-item">
            <a href={site.githubUrl} class="btn btn-icon" target="_blank">
              <Icon name="brand-github" />
            </a>
          </li>
          <li class="nav-item">
            <a href={previewUrl} class="btn btn-primary" target="_blank">
              <Icon name="eye" /> Preview
            </a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</div>
<!-- END DOCS NAVBAR -->
