@@ -2,17 +2,36 @@ import Link from '@docusaurus/Link';
22import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
33import Layout from '@theme/Layout' ;
44import Heading from '@theme/Heading' ;
5+ import { motion , AnimatePresence } from 'framer-motion' ;
6+ import { useLocation } from '@docusaurus/router' ;
7+
8+ const containerVariants = {
9+ hidden : { opacity : 0 } ,
10+ show : {
11+ opacity : 1 ,
12+ transition : { staggerChildren : 0.1 }
13+ }
14+ } ;
15+
16+ const itemVariants = {
17+ hidden : { opacity : 0 , y : 20 } ,
18+ show : { opacity : 1 , y : 0 , transition : { type : 'spring' as const , stiffness : 300 , damping : 24 } }
19+ } ;
520
621function HomepageHeader ( ) {
722 return (
823 < header className = "hero hero--primary" style = { { padding : '4rem 0' , textAlign : 'center' } } >
924 < div className = "container" >
10- < Heading as = "h1" className = "hero__title" >
11- Topper Wiki Portal
12- </ Heading >
13- < p className = "hero__subtitle" >
14- Welcome to the documentation hub for Topper and its ecosystem plugins.
15- </ p >
25+ < motion . div variants = { itemVariants } >
26+ < Heading as = "h1" className = "hero__title" >
27+ Topper Wiki Portal
28+ </ Heading >
29+ </ motion . div >
30+ < motion . div variants = { itemVariants } >
31+ < p className = "hero__subtitle" >
32+ Welcome to the documentation hub for Topper and its ecosystem plugins.
33+ </ p >
34+ </ motion . div >
1635 </ div >
1736 </ header >
1837 ) ;
@@ -54,7 +73,7 @@ const PortalList: PortalItem[] = [
5473
5574function PortalCard ( { title, emoji, description, link } : PortalItem ) {
5675 return (
57- < div className = "col col--6" style = { { marginBottom : '2rem' } } >
76+ < motion . div variants = { itemVariants } className = "col col--6" style = { { marginBottom : '2rem' } } >
5877 < div className = "card" style = { { height : '100%' , border : '1px solid var(--ifm-color-emphasis-300)' , display : 'flex' , flexDirection : 'column' } } >
5978 < div className = "card__header" style = { { display : 'flex' , alignItems : 'center' , gap : '0.75rem' , padding : '1.25rem' } } >
6079 < span style = { { fontSize : '2.5rem' } } > { emoji } </ span >
@@ -69,28 +88,40 @@ function PortalCard({ title, emoji, description, link }: PortalItem) {
6988 </ div >
7089 </ div >
7190 </ div >
72- </ div >
91+ </ motion . div >
7392 ) ;
7493}
7594
7695export default function Home ( ) : React . JSX . Element {
96+ const location = useLocation ( ) ;
97+
7798 return (
7899 < Layout
79100 title = "Welcome to Topper Wiki Portal"
80101 description = "Gateway to Topper, TimedTopper, GroupTopper, and Cachy plugin documentations."
81102 >
82- < HomepageHeader />
83- < main >
84- < section style = { { padding : '3rem 0' } } >
85- < div className = "container" >
86- < div className = "row" >
87- { PortalList . map ( ( props , idx ) => (
88- < PortalCard key = { idx } { ...props } />
89- ) ) }
90- </ div >
91- </ div >
92- </ section >
93- </ main >
103+ < AnimatePresence mode = "wait" >
104+ < motion . div
105+ key = { location . pathname }
106+ variants = { containerVariants }
107+ initial = "hidden"
108+ animate = "show"
109+ exit = { { opacity : 0 , y : - 20 , transition : { duration : 0.2 } } }
110+ >
111+ < HomepageHeader />
112+ < main >
113+ < section style = { { padding : '3rem 0' } } >
114+ < div className = "container" >
115+ < div className = "row" >
116+ { PortalList . map ( ( props , idx ) => (
117+ < PortalCard key = { idx } { ...props } />
118+ ) ) }
119+ </ div >
120+ </ div >
121+ </ section >
122+ </ main >
123+ </ motion . div >
124+ </ AnimatePresence >
94125 </ Layout >
95126 ) ;
96127}
0 commit comments