| 1 |
import { __ } from '@wordpress/i18n'; |
| 2 |
import { arrowDown, Icon } from '@wordpress/icons'; |
| 3 |
import { AnimatePresence, motion } from 'framer-motion'; |
| 4 |
|
| 5 |
export const ScrollDownButton = ({ canScrollDown, onClick }) => { |
| 6 |
return ( |
| 7 |
<div className="pointer-events-none sticky bottom-1 flex h-8 items-center justify-center"> |
| 8 |
<AnimatePresence> |
| 9 |
{canScrollDown ? ( |
| 10 |
<motion.button |
| 11 |
key="scroll-down" |
| 12 |
initial={{ opacity: 0 }} |
| 13 |
animate={{ opacity: 1 }} |
| 14 |
exit={{ opacity: 0 }} |
| 15 |
transition={{ duration: 0.2, exit: { duration: 0 } }} |
| 16 |
onClick={onClick} |
| 17 |
type="button" |
| 18 |
className="pointer-events-auto flex h-fit items-center justify-center gap-2 whitespace-nowrap rounded-full border border-gray-500 bg-white/90 p-1 text-sm font-medium text-design-main shadow-lg transition-colors hover:bg-gray-100 focus-visible:ring-design-main disabled:pointer-events-none" |
| 19 |
> |
| 20 |
<Icon fill="currentColor" icon={arrowDown} size={20} /> |
| 21 |
<span className="sr-only"> |
| 22 |
{__('Scroll down', 'extendify-local')} |
| 23 |
</span> |
| 24 |
</motion.button> |
| 25 |
) : null} |
| 26 |
</AnimatePresence> |
| 27 |
</div> |
| 28 |
); |
| 29 |
}; |
| 30 |
|