Skip to content

Commit

Permalink
feat: add enter animation for HeadGradient
Browse files Browse the repository at this point in the history
  • Loading branch information
lxchapu committed May 27, 2024
1 parent 30d0587 commit 9773aba
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
5 changes: 0 additions & 5 deletions src/components/HeadGadient.astro

This file was deleted.

14 changes: 14 additions & 0 deletions src/components/head-gradient/HeadGradient.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { motion } from 'framer-motion'

export function HeadGradient() {
return (
<motion.div
className="absolute -z-1 top-0 inset-x-0 h-[350px] bg-gradient-to-r from-accent/5 to-accent/15"
style={{
maskImage: 'linear-gradient(black, transparent)',
}}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
></motion.div>
)
}
1 change: 1 addition & 0 deletions src/components/head-gradient/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { HeadGradient } from './HeadGradient'
4 changes: 2 additions & 2 deletions src/layouts/MarkdownLayout.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import Layout from './Layout.astro'
import HeadGadient from '@/components/HeadGadient.astro'
import { HeadGradient } from '@/components/head-gradient'
import Footer from '@/components/footer/Footer.astro'
import { Header } from '@/components/header/Header'
import { SearchPanel } from '@/components/SearchPanel'
Expand Down Expand Up @@ -32,7 +32,7 @@ const { title, description, image, mdTitle, mdDescription, mdSlug } = Astro.prop

<Header client:only="react" transition:persist="header" />
<main class="relative z-1 pt-16 min-h-main bg-primary">
<HeadGadient />
<HeadGradient client:idle />
<slot />
</main>
<Footer />
Expand Down

0 comments on commit 9773aba

Please sign in to comment.