mirror of
https://github.com/skidoodle/albert.lol.git
synced 2025-02-15 06:09:15 +01:00
v3
This commit is contained in:
parent
3a92d65900
commit
7dedfba1f9
31 changed files with 2971 additions and 1859 deletions
102
pages/index.tsx
102
pages/index.tsx
|
@ -1,52 +1,62 @@
|
|||
import { GetServerSideProps } from 'next'
|
||||
import Head from 'next/head'
|
||||
import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
import React from 'react'
|
||||
import useSWR from 'swr'
|
||||
import FadeIn from 'react-fade-in'
|
||||
import Body from 'components/Body'
|
||||
import Icon from 'components/Icon'
|
||||
import IconLayout from 'components/IconLayout'
|
||||
import MainLayout from 'components/MainLayout'
|
||||
import Spotify from 'components/Spotify'
|
||||
import Weather from 'components/Weather'
|
||||
import { FaSteam, FaGithub, FaEnvelope } from 'react-icons/fa'
|
||||
import { RiInstagramFill } from 'react-icons/ri'
|
||||
import { SiDiscord } from 'react-icons/si'
|
||||
import dynamic from 'next/dynamic'
|
||||
const Time = dynamic(() => import('components/Time'), {
|
||||
ssr: false,
|
||||
})
|
||||
|
||||
const Home = ({data}: any) => {
|
||||
import { socials } from 'components/data/socials'
|
||||
import { Icon } from 'components/Icon'
|
||||
import profilePic from '../public/profile.webp'
|
||||
import { Toaster } from 'react-hot-toast'
|
||||
import { FaSpotify } from 'react-icons/fa'
|
||||
|
||||
const fetcher = (url: RequestInfo) => fetch(url).then(r => r.json())
|
||||
|
||||
export default function() {
|
||||
const { data: spotify } = useSWR('/api/spotify', fetcher, { refreshInterval: 1000 })
|
||||
if(!spotify) return
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>albert</title>
|
||||
</Head>
|
||||
<Body>
|
||||
<FadeIn>
|
||||
<MainLayout />
|
||||
<IconLayout>
|
||||
<Icon icon={<FaGithub />} reference={'https://github.com/skidoodle'} copy={false} />
|
||||
<Icon icon={<FaSteam />} reference={'https://steamcommunity.com/id/_albert'} copy={false} />
|
||||
<Icon icon={<FaEnvelope />} reference={'contact@albert.lol'} copy={true} />
|
||||
<Icon icon={<RiInstagramFill />} reference={'https://instagram.com/albertadam_'} copy={false} />
|
||||
<Icon icon={<SiDiscord />} reference={'albert#8838'} copy={true} />
|
||||
</IconLayout>
|
||||
<Time />
|
||||
<Weather data={data} />
|
||||
<Spotify />
|
||||
</FadeIn>
|
||||
</Body>
|
||||
<FadeIn>
|
||||
<div className='px-8 w-11/12 m-auto rounded-lg max-w-4xl'>
|
||||
<div className='flex flex-col justify-center items-center mt-32 md:mt-56'>
|
||||
<Image src={profilePic} className="rounded-full text-center" height={150} width={150}/>
|
||||
|
||||
<h1 className='text-4xl font-bold -mt-1'>albert</h1>
|
||||
|
||||
<p className='text-[#9ca3af] text-xl flex flex-wrap items-center justify-center whitespace-pre-wrap'>
|
||||
{ Math.floor((new Date().getTime() - new Date('2004.07.22').getTime()) / (1000 * 60 * 60 * 24 * 365.25)) }
|
||||
yrs old <b className='font-semibold'>system administrator</b> and student from Hungary
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<hr className='border-t-[#727277] w-4/5 md:w-2/5 m-auto mt-5 md:mt-8'/>
|
||||
|
||||
<div className='mt-3 flex justify-center items-center'>
|
||||
<FaSpotify className='text-[#32a866]' />
|
||||
|
||||
<p className='font-semibold'>Listening to
|
||||
{
|
||||
spotify.song
|
||||
? <Link href={`${spotify.song.url}`}>
|
||||
<a target='_blank' className='text-[#32a866]'> { spotify.song.title || 'nothing' }</a>
|
||||
</Link>
|
||||
|
||||
: <a className='text-[#32a866]'> nothing</a>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between items-center text-3xl mt-11 md:mt-16 max-w-sm m-auto'>
|
||||
{ socials.map(social => (
|
||||
<Icon key={ social.id } reference={ social.ref } copyValue={ social.copyValue }>{ React.createElement(social.icon) }</Icon>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Toaster />
|
||||
</FadeIn>\
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async () => {
|
||||
const response = await fetch('https://api.openweathermap.org/data/2.5/weather?lat=47.51&lon=19.04&appid=1b3c10c18e894eaf1fd63eedde53fa54&units=metric')
|
||||
const data = await response.json()
|
||||
|
||||
return {
|
||||
props: { data }
|
||||
}
|
||||
}
|
||||
|
||||
export default Home
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue