feat(docs): add fly float animation

This commit is contained in:
YunYouJun 2024-08-13 23:14:22 +08:00
parent 9bb1a65602
commit ff9490d8ae
9 changed files with 149 additions and 25 deletions

View File

@ -0,0 +1,17 @@
<template>
<div flex="~ col" class="justify-center items-center" gap="6" m="auto y-8" font="black">
<h3>
<div class="work-in-progress-icon text-4xl fly-animation">
🧪
</div>
</h3>
<code flex="inline" gap="3" class="inline-flex text-xl! px-4! w-280px" justify-center>
<span>pnpm</span>
<span>create</span>
<span text="purple">valaxy</span>
</code>
<span text="4xl">WORK IN PROGRESS</span>
</div>
</template>

View File

@ -15,6 +15,7 @@ hero:
- theme: brand
text: hero.actions.get-started
link: /guide/getting-started
type: fly
- theme: alt
text: hero.actions.view-github
link: https://github.com/YunYouJun/valaxy
@ -59,15 +60,6 @@ features:
details: features.electron.details
---
<div m="auto y-8" text="center" font="black">
<h3 text="3xl">🧪</h3>
<code class="inline-flex text-xl! mt-4 px-4!">
<span>pnpm</span> create <span text="purple">valaxy</span>
</code>
<span text="4xl">WORK IN PROGRESS</span>
</div>
<WorkInProgress />
<ValaxySponsors />

13
docs/styles/index.scss Normal file
View File

@ -0,0 +1,13 @@
@keyframes fly {
from {
transform: translateY(0.5em);
}
to {
transform: translateY(-0.5em);
}
}
.fly-animation {
animation: fly 0.8s ease-in-out infinite alternate;
}

View File

@ -31,6 +31,8 @@ const { t } = useI18n()
bg="gradient-to-r"
p="x-6"
>
{{ t(text) }}
<slot>
{{ t(text) }}
</slot>
</AppLink>
</template>

View File

@ -0,0 +1,90 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
defineProps<{
theme: 'brand' | 'alt'
link: string
text: string
}>()
const { t } = useI18n()
</script>
<template>
<PressButton
class="overflow-hidden"
:theme="theme"
:link="link"
:text="text"
>
<div class="flex justify-center items-center">
<div class="svg-wrapper">
<div class="icon" />
</div>
<span>
{{ t(text) }}
</span>
</div>
</PressButton>
</template>
<style lang="scss">
// @see https://freecodez.com/post/h1s1z8j
.sese-btn {
span {
display: block;
margin-left: 0.3em;
transition: all 0.3s ease-in-out;
}
.svg-wrapper {
position: absolute;
display: inline-flex;
justify-content: center;
align-items: center;
}
.icon {
transform-origin: center center;
transition: all 0.3s ease-in-out;
// mask
mask-image: url('/favicon.svg');
mask-size: 100% 100%;
background-color: white;
width: 1.2em;
height: 1.2em;
transform: translateX(-1.2em) rotate(0) scale(1);
opacity: 0;
}
&:hover .svg-wrapper {
animation: fly 0.6s ease-in-out infinite alternate;
}
&:hover .icon {
display: inline-flex;
transform: translateX(0) rotate(0deg) scale(1.1);
opacity: 1;
}
&:hover span {
transform: translateX(5.5em);
opacity: 0;
}
&:active {
transform: scale(0.95);
}
}
@keyframes fly {
from {
transform: translateY(0.1em);
}
to {
transform: translateY(-0.1em);
}
}
</style>

View File

@ -23,11 +23,21 @@ const { t } = useI18n()
<span mx-1 class="break-keep">{{ t('banner.framework') }}</span>
</h2>
<div p="2" text="center">
<PressButton
v-for="action in fm.hero.actions" :key="action.link" :theme="action.theme" :link="action.link"
:text="action.text"
/>
<div p="2" text="center" class="flex justify-center items-center">
<template v-for="action in fm.hero.actions" :key="action.link">
<PressGetStarted
v-if="action.type === 'fly'"
:theme="action.theme"
:link="action.link"
:text="action.text"
/>
<PressButton
v-else
:theme="action.theme"
:link="action.link"
:text="action.text"
/>
</template>
</div>
<br>

View File

@ -1,3 +1,11 @@
.i-valaxy-logo {
background: url("/favicon.svg") no-repeat;
background-size: 100% 100%;
background-color: transparent;
width: 1.2em;
height: 1.2em;
}
.gradient-text {
background-clip: text;
/* stylelint-disable-next-line property-no-vendor-prefix */

View File

@ -5,7 +5,7 @@ import valaxyLogoPng from '../assets/images/valaxy-logo.png'
<template>
<div class="valaxy-logo-container" relative inline-flex justify="center" items="center">
<div class="absolute bg-img" />
<img w="50" aspect="420/386" m="auto" :src="valaxyLogoPng" alt="Valaxy Logo" z="1">
<img class="fly-animation" w="50" aspect="420/386" m="auto" :src="valaxyLogoPng" alt="Valaxy Logo" z="1">
</div>
</template>

View File

@ -1,8 +0,0 @@
{
"rewrites": [
{
"source": "/:path*",
"destination": "/index.html"
}
]
}