You've already forked AstralRinth
forked from didirus/AstralRinth
NavRow animation improvements
This commit is contained in:
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@@ -28,15 +28,25 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
needs: [lint]
|
needs: [lint]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
- uses: pnpm/action-setup@v2.2.2
|
||||||
|
with:
|
||||||
|
version: 7
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
cache: pnpm
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
- name: Bump version
|
||||||
|
run: pnpm version patch --commit-hooks false --git-tag-version false
|
||||||
- name: Publish
|
- name: Publish
|
||||||
if: github.ref == 'refs/heads/main'
|
run: pnpm publish --no-git-checks --tag alpha --dry-run
|
||||||
run: npm publish --tag alpha
|
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
- uses: EndBug/add-and-commit@v9
|
- uses: EndBug/add-and-commit@v9
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
with:
|
with:
|
||||||
message: 'Bump package version [skip ci]'
|
message: 'Bump package version [skip ci]'
|
||||||
default_author: github_actions
|
default_author: github_actions
|
||||||
|
|||||||
6
.github/workflows/deploy.yml
vendored
6
.github/workflows/deploy.yml
vendored
@@ -11,8 +11,8 @@ jobs:
|
|||||||
id: cf-pages
|
id: cf-pages
|
||||||
uses: WalshyDev/cf-pages-await@v1
|
uses: WalshyDev/cf-pages-await@v1
|
||||||
with:
|
with:
|
||||||
accountEmail: ${{ secrets.CF_ACCOUNT_EMAIL }}
|
|
||||||
apiKey: ${{ secrets.CF_API_KEY }}
|
|
||||||
accountId: '9ddae624c98677d68d93df6e524a6061'
|
|
||||||
project: 'omorphia'
|
project: 'omorphia'
|
||||||
|
apiToken: ${{ secrets.CF_API_TOKEN }}
|
||||||
|
accountId: '9ddae624c98677d68d93df6e524a6061'
|
||||||
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
commitHash: ${{ steps.push-changes.outputs.commit-hash }}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
|
import { onMount } from 'svelte'
|
||||||
|
|
||||||
interface Link {
|
interface Link {
|
||||||
href: string
|
href: string
|
||||||
@@ -25,10 +26,24 @@
|
|||||||
]
|
]
|
||||||
|
|
||||||
$: basePath = path.slice(0, level).join('')
|
$: basePath = path.slice(0, level).join('')
|
||||||
|
|
||||||
|
$: activeIndex = query
|
||||||
|
? links.findIndex((link) => ($page.url.searchParams.get(query) || '') === link.href)
|
||||||
|
: links.findIndex((link) => path[level] === link.href || path[level] === link.href.slice(0, -1))
|
||||||
|
|
||||||
|
const linkElements: HTMLAnchorElement[] = []
|
||||||
|
|
||||||
|
let indicatorReady = false
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
indicatorReady = true
|
||||||
|
}, 300)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav class="navigation">
|
<nav class="navigation" class:static-indicator={!indicatorReady}>
|
||||||
{#each links as link}
|
{#each links as link, index}
|
||||||
<a
|
<a
|
||||||
href={query
|
href={query
|
||||||
? link.href
|
? link.href
|
||||||
@@ -44,8 +59,18 @@
|
|||||||
class:is-active={query
|
class:is-active={query
|
||||||
? ($page.url.searchParams.get(query) || '') === link.href
|
? ($page.url.searchParams.get(query) || '') === link.href
|
||||||
: path[level] === link.href || path[level] === link.href.slice(0, -1)}
|
: path[level] === link.href || path[level] === link.href.slice(0, -1)}
|
||||||
sveltekit:noscroll={!resetScroll || null}>{link.label}</a>
|
sveltekit:noscroll={!resetScroll || null}
|
||||||
|
bind:this={linkElements[index]}>
|
||||||
|
{link.label}
|
||||||
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
|
<div
|
||||||
|
class="navigation__indicator"
|
||||||
|
style:left={linkElements
|
||||||
|
.slice(0, activeIndex)
|
||||||
|
.map((element, index) => element.offsetWidth + 16)
|
||||||
|
.reduce((acc, a) => acc + a, 0) + 'px'}
|
||||||
|
style:width={linkElements[activeIndex]?.offsetWidth + 'px'} />
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<style lang="postcss">
|
<style lang="postcss">
|
||||||
@@ -55,26 +80,57 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
&__link {
|
&__link {
|
||||||
font-weight: var(--font-weight-bold);
|
font-weight: var(--font-weight-bold);
|
||||||
color: var(--color-text-light);
|
color: var(--color-text-light);
|
||||||
|
transition: color 0.3s ease-in-out;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
&.is-active {
|
&.is-active {
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
position: relative;
|
}
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: '';
|
content: '';
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: -1px;
|
bottom: -2px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: var(--rounded-max);
|
border-radius: var(--rounded-max);
|
||||||
height: 0.25rem;
|
height: 0.25rem;
|
||||||
|
transition: background-color 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover::after {
|
||||||
|
background-color: var(--color-brand-light);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.static-indicator {
|
||||||
|
.navigation__link {
|
||||||
|
&.is-active::after {
|
||||||
background-color: var(--color-brand);
|
background-color: var(--color-brand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__indicator {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -2px;
|
||||||
|
width: 1rem;
|
||||||
|
height: 0.25rem;
|
||||||
|
border-radius: var(--rounded-max);
|
||||||
|
background-color: var(--color-brand);
|
||||||
|
transition: width 0.3s ease-out, left 0.3s ease-out;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(.static-indicator) {
|
||||||
|
.navigation__indicator {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user