@@ -1,34 +0,0 @@
|
||||
import { useContext } from 'react';
|
||||
import { themeContext } from 'src/context/theme-context';
|
||||
import styles from 'src/styles/modules/components/buttons/themeToggler.module.scss';
|
||||
|
||||
type Props = {
|
||||
className: string;
|
||||
};
|
||||
|
||||
const ThemeToggler = (props: Props) => {
|
||||
const { theme, setTheme } = useContext(themeContext);
|
||||
const clickHandler = () => {
|
||||
const themeToSet = theme === 'light' ? 'dark' : 'light';
|
||||
setTheme(themeToSet);
|
||||
};
|
||||
|
||||
return (
|
||||
<button
|
||||
className={`${styles.button} ${props.className}`}
|
||||
onClick={clickHandler}
|
||||
>
|
||||
<span className='visually-hidden'>Change theme</span>
|
||||
<svg
|
||||
className={`icon ${styles.icon}`}
|
||||
focusable='false'
|
||||
aria-hidden='true'
|
||||
role='img'
|
||||
>
|
||||
<use href='/svg/sprite.svg#icon-theme-switcher'></use>
|
||||
</svg>
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
export default ThemeToggler;
|
@@ -27,6 +27,9 @@ const Footer = () => {
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<span> | </span>
|
||||
</li>
|
||||
))}
|
||||
<li className={styles.nav__item}>
|
||||
<a href='#' className={styles.nav__link}>
|
||||
@@ -35,10 +38,6 @@ const Footer = () => {
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<em className={styles.licence}>
|
||||
libremdb does not host any content. All content on libremdb is from IMDb. IMDb is a
|
||||
trademark of IMDb.com, Inc.
|
||||
</em>
|
||||
</footer>
|
||||
);
|
||||
};
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import Link from 'next/link';
|
||||
import ThemeToggler from 'src/components/buttons/ThemeToggler';
|
||||
import styles from 'src/styles/modules/layout/header.module.scss';
|
||||
|
||||
type Props = { full?: boolean; originalPath?: string };
|
||||
@@ -52,7 +51,6 @@ const Header = ({ full, originalPath }: Props) => {
|
||||
</svg>
|
||||
</a>
|
||||
</Link>
|
||||
<ThemeToggler className={styles.themeToggler} />
|
||||
</div>
|
||||
</div>
|
||||
{full && (
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { ReactNode } from 'react';
|
||||
import Footer from './Footer';
|
||||
import Header from './Header';
|
||||
|
||||
type Props = {
|
||||
@@ -16,7 +15,6 @@ const Layout = ({ full, children, className, originalPath }: Props) => {
|
||||
<main id='main' className={`main ${className}`}>
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user