A navigation to move between your post (previous, next)
Post Navigation
@use 'sprucecss/scss/spruce' as *;
.post-navigation {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: spacer('m');
justify-content: space-between;
}
.post-navigation-item {
$this: &;
align-items: center;
display: flex;
gap: spacer('s');
text-decoration: none;
&:hover {
#{$this}__icon {
background-color: color('icon-background-hover', 'navigation');
color: color('icon-foreground-hover', 'navigation');
}
}
&--next {
margin-inline-start: auto;
text-align: end;
}
&__icon {
@include transition;
align-items: center;
background-color: color('icon-background', 'navigation');
block-size: 3rem;
border-radius: config('border-radius', $btn, false);
color: color('icon-foreground', 'navigation');
display: flex;
flex-shrink: 0;
inline-size: 3rem;
justify-content: center;
svg {
--size: 1rem;
block-size: var(--size);
inline-size: var(--size);
@at-root {
[dir='rtl'] & {
transform: rotate(180deg);
}
}
}
}
&__caption {
color: color('text');
line-height: config('line-height-md', $typography);
}
&__title {
color: color('primary');
display: flex;
font-weight: 700;
}
}
<nav class="post-navigation">
<a class="post-navigation-item post-navigation-item--prev" href="#">
<span class="post-navigation-item__icon">
<svg aria-hidden="true" fill="none" focusable="false" height="24" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" stroke="currentColor" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<line x1="19" y1="12" x2="5" y2="12"></line>
<polyline points="12 19 5 12 12 5"></polyline>
</svg>
</span>
<span class="post-navigation-item__caption">Previous<span class="post-navigation-item__title">5 Laravel E-commerce Packages</span>
</span>
</a>
<a class="post-navigation-item post-navigation-item--next" href="#">
<span class="post-navigation-item__caption">Next<span class="post-navigation-item__title">What Is the Accessibility Tree?</span>
</span>
<span class="post-navigation-item__icon">
<svg aria-hidden="true" fill="none" focusable="false" height="24" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" stroke="currentColor" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<line x1="5" y1="12" x2="19" y2="12"></line>
<polyline points="12 5 19 12 12 19"></polyline>
</svg>
</span>
</a>
</nav>
Post Navigation


