diff options
author | João Augusto Costa Branco Marado Torres <torres.dev@disroot.org> | 2025-07-27 10:58:32 -0300 |
---|---|---|
committer | João Augusto Costa Branco Marado Torres <torres.dev@disroot.org> | 2025-07-27 10:58:32 -0300 |
commit | 9f3b746f72bc7895d3f659a7201969349f5e5298 (patch) | |
tree | 094f189733c06570e351d837996e663192e960d8 /src/components/templates | |
parent | 3159d2fd4bf98571c6131153229aa5bf96d7a56e (diff) |
refactor: cleaner code
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/components/templates')
-rw-r--r-- | src/components/templates/PrevNextNav.astro | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/components/templates/PrevNextNav.astro b/src/components/templates/PrevNextNav.astro new file mode 100644 index 0000000..fe8bd8d --- /dev/null +++ b/src/components/templates/PrevNextNav.astro @@ -0,0 +1,56 @@ +--- +interface Props { + previous?: string | URL; + next?: string | URL; + label?: string; +} + +const { next, previous, label } = Astro.props; +--- + +{ + (next || previous) && ( + <nav> + { + previous && ( + <p> + < <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> > + </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> |