-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
58 additions
and
54 deletions.
There are no files selected for viewing
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
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
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
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 |
---|---|---|
@@ -1,14 +1,51 @@ | ||
import {Variants, m, useScroll, useTransform} from 'framer-motion'; | ||
import {useRef} from 'react'; | ||
import teachersListConfig from './teachersListConfig'; | ||
import clsx from 'clsx'; | ||
|
||
/** | ||
* Props. | ||
*/ | ||
type TeacherBlockProps = (typeof teachersListConfig)[number]; | ||
|
||
const cardVariants: Variants = { | ||
offscreen: { | ||
rotate: -10, | ||
transition: { | ||
type: 'spring', | ||
duration: 0.8, | ||
}, | ||
}, | ||
onscreen: { | ||
rotate: 0, | ||
transition: { | ||
type: 'spring', | ||
duration: 0.8, | ||
}, | ||
}, | ||
}; | ||
|
||
const nameCn = clsx('text-7xl'); | ||
const textCn = clsx('text-3xl', 'mt-4'); | ||
|
||
/** | ||
* @param {TeacherBlockProps} props Props. | ||
* @returns React component. | ||
*/ | ||
export default function Teacher({name}: TeacherBlockProps) { | ||
return <div>{name}</div>; | ||
export default function Teacher({name, style, superPowers, groupLessons}: TeacherBlockProps) { | ||
const ref = useRef(null); | ||
const {scrollYProgress} = useScroll({target: ref, offset: ['start end', 'end end']}); | ||
const opacity = useTransform(scrollYProgress, [0, 0.25, 0.9, 1], [0, 1, 1, 0]); | ||
|
||
return ( | ||
<m.div | ||
style={{opacity}} | ||
ref={ref} | ||
> | ||
<div className={nameCn}>{name}</div> | ||
<div className={textCn}>{style}</div> | ||
<div className={textCn}>{`Super powers: ${superPowers}`}</div> | ||
<div className={textCn}>{`Group lessons: ${groupLessons}`}</div> | ||
</m.div> | ||
); | ||
} |
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
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
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
This file was deleted.
Oops, something went wrong.