File size: 959 Bytes
dbcdc7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import clsx from 'clsx';
import { useOptions } from '/src/utils/optionsContext';
import { memo, useMemo } from 'react';

const Logo = memo(({ options, action, width, height }) => {
  const { options: op } = useOptions();

  const style = useMemo(() => {
    const lightAdj = op.type === 'light' ? { filter: 'invert(80%)' } : {};
    const dimensions = {
      ...(width && { width }),
      ...(height && { height }),
    };
    return { ...lightAdj, ...dimensions };
  }, [op.type, width, height]);

  const className = useMemo(
    () =>
      clsx(
        options,
        action && 'cursor-pointer duration-300 ease-out scale-[1.12] hover:scale-[1.15]',
        'select-none',
      ),
    [options, action],
  );

  return (
    <img
      src="/logo.svg"
      className={className}
      id="btn-logo"
      draggable="false"
      alt="logo"
      onClick={action}
      style={style}
    />
  );
});

Logo.displayName = 'Logo';
export default Logo;