summaryrefslogtreecommitdiff
path: root/src/components/templates/PrevNextNav.astro
blob: f60a4cd7e5ee62078fb18200f5344fb9031458e8 (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
57
58
59
---
interface Props {
  first?: string | URL;
  previous?: string | URL;
  next?: string | URL;
  last?: string | URL;
  label?: string;
}

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

{
  (first || next || previous || last) && (
    <nav>
      {first && <p><a href={Astro.props.first}>Primeiro</a></p>}
      {
        previous && (
          <p>
            &lt; <a rel="prev" href={Astro.props.previous}>Anterior</a>
          </p>
        )
      }
      {label && <span class="small" set:html={label} />}
      {
        next && (
          <p>
            <a rel="next" href={Astro.props.next}>Próximo</a> &gt;
          </p>
        )
      }
      {last && <p><a href={Astro.props.last}>Último</a></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>