From dea0fbf9bdbcfdaf2f0d6b97d476517ba83d3ce1 Mon Sep 17 00:00:00 2001 From: skidoodle Date: Tue, 2 Jan 2024 03:14:59 +0100 Subject: [PATCH] fix: --- src/components/Icon.tsx | 6 +++--- src/components/SocialLayout.tsx | 6 +++--- src/components/SpotifyCard.tsx | 4 ++-- src/components/ThemeSwitcher.tsx | 32 +++++++++++++++----------------- src/components/data/Socials.ts | 2 +- src/pages/index.tsx | 4 ++-- src/styles/globals.scss | 12 +----------- src/utils/type.ts | 6 ++++++ 8 files changed, 33 insertions(+), 39 deletions(-) diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx index c8ede3a..2b5f7cd 100644 --- a/src/components/Icon.tsx +++ b/src/components/Icon.tsx @@ -1,4 +1,4 @@ -import { socials } from '@/components/data/Socials' +import { Socials } from '@/components/data/Socials' import copy from 'copy-to-clipboard' import toast from 'react-hot-toast' import Link from 'next/link' @@ -27,7 +27,7 @@ export const Icon = ({ children, reference, copyValue }: Icon) => { href={''} className={`cursor-pointer`} aria-label={ - socials.find((social) => social.ref === reference)?.ariaLabel + Socials.find((social) => social.ref === reference)?.ariaLabel } onClick={() => { notify(), copy(reference) @@ -43,7 +43,7 @@ export const Icon = ({ children, reference, copyValue }: Icon) => { href={reference} target='_blank' className={'cursor-pointer'} - aria-label={socials.find((social) => social.ref === reference)?.ariaLabel} + aria-label={Socials.find((social) => social.ref === reference)?.ariaLabel} > {children} diff --git a/src/components/SocialLayout.tsx b/src/components/SocialLayout.tsx index 8dda7c0..5303d42 100644 --- a/src/components/SocialLayout.tsx +++ b/src/components/SocialLayout.tsx @@ -1,11 +1,11 @@ -import { socials } from '@/components/data/Socials' +import { Socials } from '@/components/data/Socials' import { Icon } from '@/components/Icon' import React from 'react' export const SocialLayout = () => { return ( -
- {socials.map((social) => ( +
+ {Socials.map((social) => ( { )}
-
+
{ ) : ( <> - +
Not listening to anything diff --git a/src/components/ThemeSwitcher.tsx b/src/components/ThemeSwitcher.tsx index 2ba4e21..cc702df 100644 --- a/src/components/ThemeSwitcher.tsx +++ b/src/components/ThemeSwitcher.tsx @@ -1,35 +1,33 @@ -import { BsSunFill, BsMoonFill } from 'react-icons/bs' -import { useEffect, useState } from 'react' +import { VscColorMode } from 'react-icons/vsc' import { useTheme } from 'next-themes' export const ThemeSwitcher = () => { - const [mounted, setMounted] = useState(false) const { theme, setTheme } = useTheme() const toggle = () => { - if (theme === 'dark') { - setTheme('light') - } else { - setTheme('dark') + switch (theme) { + case 'dark': + setTheme('light') + break + case 'light': + setTheme('dark') + break + default: + setTheme('dark') + break } } - useEffect(() => setMounted(true), []) - - if (!mounted) return null - return ( ) } diff --git a/src/components/data/Socials.ts b/src/components/data/Socials.ts index 054457f..b0faf97 100644 --- a/src/components/data/Socials.ts +++ b/src/components/data/Socials.ts @@ -10,7 +10,7 @@ type Socials = { ariaLabel?: string } -export const socials: Array = [ +export const Socials: Array = [ { id: 1, ref: 'https://github.com/skidoodle', diff --git a/src/pages/index.tsx b/src/pages/index.tsx index a2febc7..73f46f4 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -12,8 +12,8 @@ export default function Home() {
-

albert

-

+

albert

+

{age()}yo devops engineer

diff --git a/src/styles/globals.scss b/src/styles/globals.scss index 38f13f9..fb8091b 100644 --- a/src/styles/globals.scss +++ b/src/styles/globals.scss @@ -23,14 +23,4 @@ background-color: #8040ee; border-radius: 10px; } -} - -:root { - --background: #fff; - --foreground: #000; -} - -[data-theme='dark'] { - --background: #000; - --foreground: #fff; -} +} \ No newline at end of file diff --git a/src/utils/type.ts b/src/utils/type.ts index 5126dd7..fe4a4ef 100644 --- a/src/utils/type.ts +++ b/src/utils/type.ts @@ -14,3 +14,9 @@ export type SongResult = { duration: number is_playing: boolean } + +export type Icon = { + children: React.ReactNode + reference: string + copyValue?: boolean +}