Dark magic refactor

This commit is contained in:
q9i 2024-02-15 21:09:45 -08:00
parent 1e4accc26a
commit 56c25bb7f6
4 changed files with 46 additions and 46 deletions

View file

@ -112,23 +112,6 @@ export default function AuthorDisplay({
) )
} }
const NationalityDisplay = ({
nationality,
}: Readonly<{ nationality: string }>) => {
const nationalityData = nationalities[nationality]
const { demonym, flag } = nationalityData
return (
<div className='flex items-center'>
<img
src={flag}
className='w-10 shadow-md shadow-slate-300'
alt={`${demonym} flag`}
/>
<span className='mx-3 font-semibold'>{demonym}</span>
</div>
)
}
const Bio = () => { const Bio = () => {
const { bio } = data const { bio } = data
if (!bio) return null if (!bio) return null
@ -172,16 +155,6 @@ export default function AuthorDisplay({
<hr className='mx-auto w-full h-1 border-0 bg-slate-200 my-2 rounded-md' /> <hr className='mx-auto w-full h-1 border-0 bg-slate-200 my-2 rounded-md' />
<OtherPositions /> <OtherPositions />
<FormerPositions /> <FormerPositions />
<h1 className='text-3xl md:my-6 my-4 font-serif'>
Ethnicity and Nationality
</h1>
<div className='flex gap-2 flex-wrap'>
{nationality.map((n: string) => (
<Fragment key={n}>
<NationalityDisplay nationality={n} />
</Fragment>
))}
</div>
<Bio /> <Bio />
{authorsDocuments.length > 0 && ( {authorsDocuments.length > 0 && (
<> <>

View file

@ -3,6 +3,7 @@ import Konami from 'react-konami-code'
import { Snowfall } from 'react-snowfall' import { Snowfall } from 'react-snowfall'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { nationalities } from '@/app/db/data' import { nationalities } from '@/app/db/data'
import { Fragment } from 'react'
export default function KonamiSnowfall({ export default function KonamiSnowfall({
nationalityList, nationalityList,
@ -25,12 +26,37 @@ export default function KonamiSnowfall({
imagesTemp.push(image) imagesTemp.push(image)
}) })
setImages(imagesTemp) setImages(imagesTemp)
}, []) }, [nationalityList])
const NationalityDisplay = ({
nationality,
}: Readonly<{ nationality: string }>) => {
const nationalityData = nationalities[nationality]
const { demonym, flag } = nationalityData
return (
<div className='flex items-center'>
<img
src={flag}
className='w-10 shadow-md shadow-slate-300'
alt={`${demonym} flag`}
/>
<span className='mx-3 font-semibold'>{demonym}</span>
</div>
)
}
return ( return (
<> <>
<Konami action={handleKonami} /> <Konami action={handleKonami} />
{snowfallActivated && ( {snowfallActivated && (
<div>
<div className="nationalities-list">
{nationalityList.map((n: string) => (
<Fragment key={n}>
<NationalityDisplay nationality={n} />
</Fragment>
))}
</div>
<Snowfall <Snowfall
snowflakeCount={500} snowflakeCount={500}
color='white' color='white'
@ -45,6 +71,7 @@ export default function KonamiSnowfall({
height: `${document.documentElement.scrollHeight}px`, height: `${document.documentElement.scrollHeight}px`,
}} }}
/> />
</div>
)} )}
</> </>
) )

View file

@ -73,13 +73,13 @@ const VersionChooser = ({
</button> </button>
</Link> </Link>
<button <button
className='ml-2 h-10 px-2.5 bg-slate-300 rounded-md' className='button-alternate'
onClick={handleClick} onClick={handleClick}
> >
Export BibTeX Export BibTeX
</button> </button>
<select <select
className='ml-2 h-10 px-2.5 bg-slate-300 rounded-md' className='select-default'
value={`v${selectedRevision}`} value={`v${selectedRevision}`}
onChange={(e) => { onChange={(e) => {
setSelectedRevision(parseInt(e.target.value.replace(/\D/g, ''), 10)) setSelectedRevision(parseInt(e.target.value.replace(/\D/g, ''), 10))

View file

@ -30,11 +30,11 @@ option {
} }
.button-alternate { .button-alternate {
@apply bg-slate-100 text-slate-700 hover:bg-blue-100 font-semibold rounded py-2 px-4 my-2 shadow-sm shadow-slate-400; @apply bg-slate-100 text-slate-700 hover:bg-blue-100 font-semibold rounded py-2 px-4 my-2 shadow-sm shadow-slate-400 mx-2;
} }
.select-default { .select-default {
@apply bg-slate-100 text-slate-700 hover:bg-blue-100 font-semibold rounded py-2 px-4 my-2 shadow-sm shadow-slate-400; @apply bg-slate-100 text-slate-700 hover:bg-blue-100 font-semibold rounded py-2 px-4 my-2 shadow-sm shadow-slate-400 mx-2;
} }
.badge-base { .badge-base {