import React from 'react' import { ParallaxBanner, ParallaxProvider } from 'react-scroll-parallax' import { Box, Grid, IconButton, Typography, useTheme } from '@mui/material' import { ExpandMore } from '@mui/icons-material' type AnchorType = 'left' | 'top' | 'right' | 'bottom' type Props = { image: string title: string caption: React.ReactNode children: React.ReactNode ref?: React.ForwardedRef anchor?: AnchorType scrollTarget?: React.ForwardedRef } const Description = (props: Props) => { const theme = useTheme() switch (props.anchor) { case 'bottom': return ( {props.title} {props.caption} {props.children} ) case 'top': return ( {props.title} {props.caption} {props.children} ) case 'right': return ( {props.title} {props.caption} {props.children} ) case 'left': return ( {props.title} {props.caption} {props.children} ) } } const ProjectSpotlight = React.forwardRef((props, ref) => { const executeScroll = () => { if (typeof props.scrollTarget !== 'undefined') { const target = props.scrollTarget as React.MutableRefObject target.current?.scrollIntoView() } } // run this function from an event handler or an effect to execute scroll return (
{props.scrollTarget && ( )}
) }) export default ProjectSpotlight