summaryrefslogtreecommitdiff
path: root/src/components/templates/PrevNextNav.astro
blob: fe8bd8d18f8755bcaeadc312c0bec6c1b9aed780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
interface Props {
  previous?: string | URL;
  next?: string | URL;
  label?: string;
}

const { next, previous, label } = Astro.props;
---

{
  (next || previous) && (
    <nav>
      {
        previous && (
          <p>
            &lt; <a rel="prev" href={`/blog/${Astro.props.previous}`}
            >Anterior</a>
          </p>
        )
      }
      {label && <span class="small" set:html={label} />}
      {
        next && (
          <p>
            <a rel="next" href={`/blog/${Astro.props.next}`}>Próximo</a> &gt;
          </p>
        )
      }
    </nav>
  )
}

<style>
  nav {
    display: flex;
    align-items: center;
    padding-block: calc(var(--size-2) * 1em);
    gap: calc(var(--size-2) * 1em);
    justify-content: center;
    & > p {
      border-radius: calc(var(--size-0) * 1em);
      border-width: 1px;
      box-shadow: 0 1px 2px var(--color-light);
      font-size: calc(var(--size-3) * 1rem);
      font-weight: 500;
      padding-inline: calc(var(--size-3) * 1em);
      padding-block: calc(var(--size-2) * 1em);
      display: inline-flex;
      gap: calc(var(--size-2) * 1em);
      align-items: center;
      justify-content: center;
      height: 2ch;
    }
  }
</style>