Skip to content

Commit

Permalink
minor changes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
ukorvl committed Jul 14, 2023
1 parent d551742 commit ab708e6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/Footer/Location.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');

/**
Expand Down
15 changes: 11 additions & 4 deletions components/Title/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
13 changes: 7 additions & 6 deletions components/Title/useTitleDynamicBackground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends HTMLElement>(ref: RefObject<T>) {
Expand All @@ -20,14 +20,15 @@ export default function useTitleDynamicBackground<T extends HTMLElement>(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]);
}

0 comments on commit ab708e6

Please sign in to comment.