This commit is contained in:
skidoodle 2024-01-02 03:14:59 +01:00
parent a65ed73814
commit dea0fbf9bd
8 changed files with 33 additions and 39 deletions

View file

@ -1,4 +1,4 @@
import { socials } from '@/components/data/Socials' import { Socials } from '@/components/data/Socials'
import copy from 'copy-to-clipboard' import copy from 'copy-to-clipboard'
import toast from 'react-hot-toast' import toast from 'react-hot-toast'
import Link from 'next/link' import Link from 'next/link'
@ -27,7 +27,7 @@ export const Icon = ({ children, reference, copyValue }: Icon) => {
href={''} href={''}
className={`cursor-pointer`} className={`cursor-pointer`}
aria-label={ aria-label={
socials.find((social) => social.ref === reference)?.ariaLabel Socials.find((social) => social.ref === reference)?.ariaLabel
} }
onClick={() => { onClick={() => {
notify(), copy(reference) notify(), copy(reference)
@ -43,7 +43,7 @@ export const Icon = ({ children, reference, copyValue }: Icon) => {
href={reference} href={reference}
target='_blank' target='_blank'
className={'cursor-pointer'} className={'cursor-pointer'}
aria-label={socials.find((social) => social.ref === reference)?.ariaLabel} aria-label={Socials.find((social) => social.ref === reference)?.ariaLabel}
> >
{children} {children}
</Link> </Link>

View file

@ -1,11 +1,11 @@
import { socials } from '@/components/data/Socials' import { Socials } from '@/components/data/Socials'
import { Icon } from '@/components/Icon' import { Icon } from '@/components/Icon'
import React from 'react' import React from 'react'
export const SocialLayout = () => { export const SocialLayout = () => {
return ( return (
<div className='mt-3 grid w-48 grid-flow-col space-x-8 pl-1 text-2xl'> <div className='mt-3 grid w-48 grid-flow-col space-x-8 pl-1 text-[1.7rem] leading-none'>
{socials.map((social) => ( {Socials.map((social) => (
<Icon <Icon
key={social.id} key={social.id}
reference={social.ref} reference={social.ref}

View file

@ -48,7 +48,7 @@ export const NowPlayingCard = () => {
)} )}
</h2> </h2>
</div> </div>
<div className='mt-2 bg-gray-200 rounded-full h-1 dark:bg-gray-700 bg-fixed flex w-44'> <div className='mt-2 bg-gray-200 rounded-full h-1 dark:bg-gray-700 bg-fixed flex w-48'>
<div <div
className='bg-[#1DB954] h-1 rounded-full transition-width duration-300 ease-in-out' className='bg-[#1DB954] h-1 rounded-full transition-width duration-300 ease-in-out'
style={{ style={{
@ -60,7 +60,7 @@ export const NowPlayingCard = () => {
</> </>
) : ( ) : (
<> <>
<HiMusicNote size={60} className='p-2.5' /> <HiMusicNote size={60} className='pl-1 p-2.5' />
<div className='my-auto ml-4'> <div className='my-auto ml-4'>
<div className='text-l sm:text-regular font-semibold'> <div className='text-l sm:text-regular font-semibold'>
Not listening to anything Not listening to anything

View file

@ -1,35 +1,33 @@
import { BsSunFill, BsMoonFill } from 'react-icons/bs' import { VscColorMode } from 'react-icons/vsc'
import { useEffect, useState } from 'react'
import { useTheme } from 'next-themes' import { useTheme } from 'next-themes'
export const ThemeSwitcher = () => { export const ThemeSwitcher = () => {
const [mounted, setMounted] = useState(false)
const { theme, setTheme } = useTheme() const { theme, setTheme } = useTheme()
const toggle = () => { const toggle = () => {
if (theme === 'dark') { switch (theme) {
setTheme('light') case 'dark':
} else { setTheme('light')
setTheme('dark') break
case 'light':
setTheme('dark')
break
default:
setTheme('dark')
break
} }
} }
useEffect(() => setMounted(true), [])
if (!mounted) return null
return ( return (
<button <button
aria-label='Switch Theme' aria-label='Switch Theme'
type='button' type='button'
className='ml-auto mr-5 mt-5 flex' className={`ml-auto mr-5 mt-5 flex transition duration-300 ease-in-out ${
theme === 'light' ? 'hover:bg-gray-300' : 'dark:hover:bg-gray-700'
} p-2 rounded-full`}
onClick={() => toggle()} onClick={() => toggle()}
> >
{theme === 'light' ? ( <VscColorMode size={30} />
<BsMoonFill style={{ fill: 'black' }} size={25} />
) : (
<BsSunFill size={25} />
)}
</button> </button>
) )
} }

View file

@ -10,7 +10,7 @@ type Socials = {
ariaLabel?: string ariaLabel?: string
} }
export const socials: Array<Socials> = [ export const Socials: Array<Socials> = [
{ {
id: 1, id: 1,
ref: 'https://github.com/skidoodle', ref: 'https://github.com/skidoodle',

View file

@ -12,8 +12,8 @@ export default function Home() {
<FadeIn> <FadeIn>
<div className='ml-[10%] mr-[10%]'> <div className='ml-[10%] mr-[10%]'>
<div className='mx-auto mb-16 mt-32 flex max-w-3xl flex-col'> <div className='mx-auto mb-16 mt-32 flex max-w-3xl flex-col'>
<h1 className='text-7xl font-bold'>albert</h1> <h1 className='text-[5rem] leading-none font-bold'>albert</h1>
<p className='mt-2 text-2xl font-semibold text-gray-600'> <p className='mt-2 text-[1.6rem] leading-none font-semibold text-slate-600'>
{age()}yo devops engineer {age()}yo devops engineer
</p> </p>
<SocialLayout /> <SocialLayout />

View file

@ -23,14 +23,4 @@
background-color: #8040ee; background-color: #8040ee;
border-radius: 10px; border-radius: 10px;
} }
} }
:root {
--background: #fff;
--foreground: #000;
}
[data-theme='dark'] {
--background: #000;
--foreground: #fff;
}

View file

@ -14,3 +14,9 @@ export type SongResult = {
duration: number duration: number
is_playing: boolean is_playing: boolean
} }
export type Icon = {
children: React.ReactNode
reference: string
copyValue?: boolean
}