mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 12:01:33 +02:00
feat: add desktop back home button on posts page
This commit is contained in:
parent
b4bd409e4b
commit
cac96eca8c
7 changed files with 54 additions and 16 deletions
|
@ -2,8 +2,7 @@
|
|||
import { ui } from '@/i18n/ui'
|
||||
import { getPageInfo } from '@/utils/page'
|
||||
|
||||
const { currentLang, isHome, isPost, isTag, isAbout, getLocalizedPath }
|
||||
= getPageInfo(Astro.url.pathname)
|
||||
const { currentLang, isHome, isPost, isTag, isAbout, getLocalizedPath } = getPageInfo(Astro.url.pathname)
|
||||
const currentUI = ui[currentLang as keyof typeof ui]
|
||||
|
||||
const isPostActive = isHome || isPost
|
||||
|
|
|
@ -46,7 +46,7 @@ function getPostPath(post: Post) {
|
|||
|
||||
{/* mobile post time */}
|
||||
<div
|
||||
class="text-3.5 leading-6.875 font-time lg:(hidden)"
|
||||
class="text-3.5 leading-6.875 font-time lg:hidden"
|
||||
transition:name={`time-${post.data.abbrlink || post.slug}-${lang}`}
|
||||
data-disable-transition-on-theme
|
||||
>
|
||||
|
|
15
src/components/Widgets/BackHome.astro
Normal file
15
src/components/Widgets/BackHome.astro
Normal file
|
@ -0,0 +1,15 @@
|
|||
<button
|
||||
id="back-button"
|
||||
class="hidden"
|
||||
lg="block absolute left--8 top-1/2 aspect-square w-4.5 translate-y--1/2 c-secondary active:scale-90 hover:c-primary"
|
||||
aria-label="Back to home"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M16.6 1.9 4.3 12l12.3 10.1.3 1.6h.8l-.5-5.5h-.8l.1 2.5L6.6 12l9.9-8.7-.1 2.5h.8l.5-5.5h-.8z"></path>
|
||||
</svg>
|
||||
</button>
|
Loading…
Add table
Add a link
Reference in a new issue