ThemeSwitch and Terminal Icon (close #15)

This commit is contained in:
Daniel Kluge 2022-10-16 19:56:31 +02:00
parent 068a3f8f1e
commit 305cae119d
4 changed files with 22 additions and 7 deletions

View File

@ -1,7 +1,7 @@
/* eslint-disable @next/next/no-img-element */ /* eslint-disable @next/next/no-img-element */
import type { NextPage } from "next"; import type { NextPage } from "next";
import Link from "next/link"; import Link from "next/link";
import { Terminal, Sun, Moon } from "phosphor-react"; import { TerminalWindow } from "phosphor-react";
import ThemeSwitch from "./ThemeSwitch"; import ThemeSwitch from "./ThemeSwitch";
import styles from "../../styles/Blog/Navigation.module.scss"; import styles from "../../styles/Blog/Navigation.module.scss";
@ -17,9 +17,9 @@ const Navigation: NextPage<{}> = () => {
</a> </a>
</Link> </Link>
<div className={styles.navLink}><Link href={"/"}><a className="nostyle">Projects</a></Link></div> <div className={styles.navLink}><Link href={"/"}><a className="nostyle">Projects</a></Link></div>
<div className={styles.navLink}><Link href={"/"}><a className="nostyle">About me</a></Link></div> <div className={styles.navLink}><Link href={"/me"}><a className="nostyle">About me</a></Link></div>
<div className={styles.spacer}></div> <div className={styles.spacer}></div>
<Terminal size={"1.5em"} /> <div className={styles.navIcon}><Link href={"/terminal"}><a className="nostyle"><TerminalWindow size={"2em"} href={"/terminal"} /></a></Link></div>
<ThemeSwitch /> <ThemeSwitch />
</nav>; </nav>;
}; };

View File

@ -20,9 +20,9 @@ const ThemeSwitch: NextPage<{ size?: string }> = ({ size }) => {
setMounted(true); setMounted(true);
}, []); }, []);
const switchTheme = (theme: string) => { const switchTheme = (newTheme: string) => {
console.log(newTheme);
if (theme === "dark") setFadeProps({ if (newTheme === "dark") setFadeProps({
sun: styles.fadeIn, sun: styles.fadeIn,
moon: styles.fadeOut moon: styles.fadeOut
}); });
@ -31,7 +31,7 @@ const ThemeSwitch: NextPage<{ size?: string }> = ({ size }) => {
moon: styles.fadeIn moon: styles.fadeIn
}); });
setTheme(theme); setTheme(newTheme);
}; };
if (!mounted) { if (!mounted) {

View File

@ -42,6 +42,13 @@
} }
} }
.navIcon {
margin-right: 15px;
cursor: pointer;
display: block;
height: 2em;
}
@media screen and (min-width: 300px) { @media screen and (min-width: 300px) {
.imgContainer { .imgContainer {
display: block; display: block;

View File

@ -2,9 +2,17 @@
position: relative; position: relative;
width: 1.5em; width: 1.5em;
height: 1.5em; height: 1.5em;
cursor: pointer;
& > * { & > * {
position: absolute; position: absolute;
opacity: 0;
transform: translate(0, 100%);
}
& > .selected {
opacity: 1;
transform: translate(0, 0);
} }
.fadeOut { .fadeOut {