diff --git a/src/components/molecules/ProjectSpotlight/ProjectSpotlight.tsx b/src/components/molecules/ProjectSpotlight/ProjectSpotlight.tsx new file mode 100644 index 0000000..f3d01c7 --- /dev/null +++ b/src/components/molecules/ProjectSpotlight/ProjectSpotlight.tsx @@ -0,0 +1,174 @@ +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 diff --git a/src/components/molecules/ProjectSpotlight/index.ts b/src/components/molecules/ProjectSpotlight/index.ts new file mode 100644 index 0000000..b12c4ad --- /dev/null +++ b/src/components/molecules/ProjectSpotlight/index.ts @@ -0,0 +1 @@ +export { default } from './ProjectSpotlight' diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index f3bf9ae..fa95ed1 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -2,4 +2,5 @@ export { default as Toobar } from './Toobar' export { default as Footer } from './Footer' export { default as CurriculumItem } from './CurriculumItem' +export { default as ProjectSpotlight } from './ProjectSpotlight' export { default as Project } from './Project'