-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add transitions to Sections bg and line
- Loading branch information
1 parent
e09f747
commit eab8feb
Showing
3 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
packages/gitbook/src/components/PageAside/AnimatedBackground.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use client'; | ||
|
||
import { Transition, motion, useReducedMotion } from 'framer-motion'; | ||
import React from 'react'; | ||
|
||
export function AnimatedBackground({ transition }: { transition?: Transition }) { | ||
const prefersReducedMotion = useReducedMotion(); | ||
|
||
return ( | ||
<motion.div | ||
layout | ||
layoutId="sections-item" | ||
className="absolute left-0 top-0 z-0 h-full w-full bg-primary-50 dark:bg-dark-3" | ||
transition={prefersReducedMotion ? { duration: 0 } : transition} | ||
/> | ||
); | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/gitbook/src/components/PageAside/AnimatedLine.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use client'; | ||
|
||
import { Transition, motion, useReducedMotion } from 'framer-motion'; | ||
import React from 'react'; | ||
|
||
import { tcls } from '@/lib/tailwind'; | ||
|
||
export function AnimatedLine({ transition }: { transition?: Transition }) { | ||
const prefersReducedMotion = useReducedMotion(); | ||
|
||
return ( | ||
<motion.div | ||
layout | ||
layoutId="sections-line" | ||
className={tcls([ | ||
'border-primary', | ||
'border-l', | ||
'dark:border-primary-400', | ||
'h-full', | ||
'absolute', | ||
'z-20', | ||
])} | ||
transition={prefersReducedMotion ? { duration: 0 } : transition} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters