From ab708e6b92d51e456dc28c3dc6cd54d277a3484f Mon Sep 17 00:00:00 2001 From: ukorvl Date: Fri, 14 Jul 2023 23:08:22 +0400 Subject: [PATCH] minor changes #4 --- components/Footer/Location.tsx | 2 +- components/Title/Title.tsx | 15 +++++++++++---- components/Title/useTitleDynamicBackground.ts | 13 +++++++------ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/components/Footer/Location.tsx b/components/Footer/Location.tsx index e5c700c..cda590e 100644 --- a/components/Footer/Location.tsx +++ b/components/Footer/Location.tsx @@ -6,7 +6,7 @@ import envConfig from '@/lib/env/envConfig'; const {LOCATION_ADDRESS_TEXT, LOCATION_GOOGLE_MAPS_LINK} = envConfig; const containerCn = clsx('flex', 'justify-center', 'flex-nowrap', 'gap-4'); -const addressCn = clsx('non-italic'); +const addressCn = clsx('not-italic'); const linkCn = clsx('animated-link'); /** diff --git a/components/Title/Title.tsx b/components/Title/Title.tsx index ef31b22..51e399b 100644 --- a/components/Title/Title.tsx +++ b/components/Title/Title.tsx @@ -2,12 +2,19 @@ import {memo, useRef} from 'react'; import {Variants, motion} from 'framer-motion'; +import clsx from 'clsx'; import useTitleDynamicBackground from './useTitleDynamicBackground'; -const titleCn = 'font-light text-9xl text-transparent bg-clip-text'; -const subtitleCn = 'text-2xl font-light tracking-widest text-center'; -const titleContainerCn = - 'font-sans select-none bg-gradient-to-r from-accent3 to-accent1 bg-clip-text'; +const titleCn = clsx('font-light', 'text-9xl', 'text-transparent', 'bg-clip-text', 'z-10'); +const subtitleCn = clsx('text-2xl', 'font-light', 'tracking-widest', 'text-center'); +const titleContainerCn = clsx( + 'font-sans', + 'select-none', + 'bg-gradient-to-r', + 'from-accent3', + 'to-accent1', + 'bg-clip-text', +); const variants: Variants = { visible: {opacity: 1}, diff --git a/components/Title/useTitleDynamicBackground.ts b/components/Title/useTitleDynamicBackground.ts index d537006..c9bf912 100644 --- a/components/Title/useTitleDynamicBackground.ts +++ b/components/Title/useTitleDynamicBackground.ts @@ -9,7 +9,7 @@ export type ScrollHandler = (props: {scrollTop?: number}) => void; const delay = 50; /** - * Hook to change title background on mouse move over element. + * Hook to change title background on mouse move. * @param ref Ref. */ export default function useTitleDynamicBackground(ref: RefObject) { @@ -20,14 +20,15 @@ export default function useTitleDynamicBackground(ref: Re return; } - element.style.backgroundColor = 'white'; - element.style.backgroundSize = '0'; + element.style.backgroundPosition = '-25% 70%'; + const handleResize = debounce((e: MouseEvent) => { - element.style.backgroundColor = 'red'; + //const {clientX, clientY} = e; + element.style.backgroundSize = '0 30%'; }, delay); - window.addEventListener('mouseover', handleResize); + document.addEventListener('mouseover', handleResize); - return () => window.removeEventListener('mouseover', handleResize); + return () => document.removeEventListener('mouseover', handleResize); }, [ref]); }