From e0c73143139398f7383c5f698e6fd1193a6c53ac Mon Sep 17 00:00:00 2001 From: m-tartari <37861893+m-tartari@users.noreply.github.com> Date: Mon, 16 Jun 2025 17:45:40 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20light=20theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit can be accessed using the theme query param (eg `?theme=system`) --- src/components/molecules/Hero/Hero.tsx | 49 +++++++++++++++++++--- src/components/molecules/Toolbar/index.tsx | 42 ++++++++++++++----- src/main.tsx | 9 +++- src/style/theme.ts | 39 ++++++++++++----- 4 files changed, 111 insertions(+), 28 deletions(-) diff --git a/src/components/molecules/Hero/Hero.tsx b/src/components/molecules/Hero/Hero.tsx index 3747d18..ad786f8 100644 --- a/src/components/molecules/Hero/Hero.tsx +++ b/src/components/molecules/Hero/Hero.tsx @@ -7,28 +7,52 @@ import { EmailIconLink, GitHubIconLink, LinkedInIconLink } from 'components/atom const Hero = (props: { scrollTarget?: React.ForwardedRef }) => { return ( ({ position: 'relative', minHeight: '100vh', boxShadow: '0 0.25em 0.5em 0 rgba(0, 0, 0, 0.25)', - backgroundImage: 'url("images/banner-blur.webp")', + backgroundImage: 'url("images/banner.webp")', backgroundPosition: 'center center', backgroundAttachment: { xs: 'scroll !important', md: 'fixed' }, backgroundSize: 'cover', - display: 'flex', justifyContent: 'center', alignItems: 'center', wrap: 'wrap', - }}> + + ...(theme.palette.mode === 'dark' && { + backgroundImage: 'url("images/banner-blur.webp")', + }), + ...(theme.palette.mode === 'light' && { + backgroundImage: 'url("images/banner.webp")', + '&::before': { + content: '""', + position: 'absolute', + top: 0, + left: 0, + width: '100%', + height: '100%', + zIndex: 0, + + backgroundImage: 'inherit', + backgroundPosition: 'center center', + backgroundAttachment: 'inherit', + backgroundSize: 'cover', + + filter: 'blur(5px)', + }, + }), + })}> ({ display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '3em', + zIndex: 1, [theme.breakpoints.down('md')]: { flexDirection: 'column', @@ -50,13 +74,19 @@ const Hero = (props: { scrollTarget?: React.ForwardedRef }) = variant="h6" color="text.secondary" sx={{ + color: t => (t.palette.mode === 'light' ? 'inherit' : 'text.secondary'), margin: '0.5em 0 0 0', pt: 1, }}> Discover some of my works below.
Send a message to get in touch. - + (t.palette.mode === 'light' ? 'inherit' : 'text.secondary')}> @@ -78,7 +108,14 @@ const Hero = (props: { scrollTarget?: React.ForwardedRef }) = (props.scrollTarget as React.RefObject).current?.scrollIntoView()} - sx={{ position: 'absolute', p: 1, bottom: 2, left: '50%', transform: 'translate(-50%, 0)' }}> + sx={{ + position: 'absolute', + p: 1, + bottom: 2, + left: '50%', + transform: 'translate(-50%, 0)', + color: t => (t.palette.mode === 'light' ? 'white' : 'text.primary'), + }}> )} diff --git a/src/components/molecules/Toolbar/index.tsx b/src/components/molecules/Toolbar/index.tsx index 261ec60..273f052 100644 --- a/src/components/molecules/Toolbar/index.tsx +++ b/src/components/molecules/Toolbar/index.tsx @@ -26,7 +26,9 @@ const AppBarButton = styled(Button)(({ theme }) => ({ color: 'inherit', ':hover': { backgroundColor: 'transparent', - color: theme.palette.primary.main, + ...(theme.palette.mode === 'dark' && { + color: theme.palette.primary.main, + }), }, })) const DrawerButton = styled(ListItemButton)(({ theme }) => ({ @@ -57,7 +59,13 @@ const CustomToolbar: React.FC = ({ drawerWidth = 240, window } const drawer = ( - + ({ + height: '100%', + textAlign: 'center', + ...(theme.palette.mode === 'light' && { backgroundColor: 'background.default' }), + })}> Michele Tartari @@ -90,10 +98,14 @@ const CustomToolbar: React.FC = ({ drawerWidth = 240, window return ( <> = ({ drawerWidth = 240, window mr: 'auto', }, })}> - Michele Tartari + + Michele Tartari + - - Home + + + Home + - - Projects + + + Projects + - - Curriculum + + + Curriculum +