fix stuff

This commit is contained in:
Youwen Wu 2024-02-10 21:22:17 -08:00
parent 4fafe38e8d
commit 62bfb94cd4
2 changed files with 34 additions and 19 deletions

View file

@ -21,7 +21,13 @@ documents {
} }
*/ */
export type FileType = 'pdf' | 'docx' | 'pptx' | 'tar.gz' | 'other' export type FileType = 'pdf' | 'docx' | 'pptx' | 'tar.gz' | 'other'
export type DocumentType = 'presentation' | 'report' | 'white paper' | 'other' export type DocumentType =
| 'presentation'
| 'report'
| 'white paper'
| 'dwm'
| 'datasheet'
| 'other'
export interface DocumentDB { export interface DocumentDB {
[key: string]: { [key: string]: {
manifest: { manifest: {
@ -66,7 +72,7 @@ export const documents: DocumentDB = {
authors: ['mbohsali', 'avenkatesh', 'ywu'], authors: ['mbohsali', 'avenkatesh', 'ywu'],
topics: ['frc', 'eecs'], topics: ['frc', 'eecs'],
dates: [1706080618], dates: [1706080618],
type: 'report', type: 'dwm',
latest: 1, latest: 1,
keywords: [ keywords: [
'team 1280/identity and branding', 'team 1280/identity and branding',

View file

@ -41,12 +41,12 @@ export default function Page({
<> <>
<span className='font-bold'>Topics: </span> <span className='font-bold'>Topics: </span>
{topics.map((t: string, i) => ( {topics.map((t: string, i) => (
<> <Fragment key={t}>
<Link href={topicList[t].wiki} target='_blank'> <Link href={topicList[t].wiki} target='_blank'>
{topicList[t].name} {topicList[t].name}
</Link> </Link>
{i !== topics.length - 1 ? ', ' : null} {i !== topics.length - 1 ? ', ' : null}
</> </Fragment>
))} ))}
</> </>
) )
@ -74,40 +74,49 @@ export default function Page({
return ( return (
<> <>
{authors.map((a: string, i) => ( {authors.map((a: string, i) => (
<> <Fragment key={a}>
<Link href={`/author/${a}`} target='_blank'> <Link href={`/author/${a}`} target='_blank'>
{authorList[a].name.first} {authorList[a].name.last} {authorList[a].name.first} {authorList[a].name.last}
</Link> </Link>
{i !== authors.length - 1 && authors.length > 2 ? ', ' : null} {i !== authors.length - 1 && authors.length > 2 ? ', ' : null}
{i === authors.length - 2 ? ' and ' : null} {i === authors.length - 2 ? ' and ' : null}
</> </Fragment>
))} ))}
</> </>
) )
} }
const generateItemBadge = (itemName: DocumentType) => { const generateItemBadge = (itemName: DocumentType) => {
let itemStyle: string = 'px-3 py-1.5 rounded inline-block w-fit mr-2 mt-4 ' let text = ''
let itemStyle: string =
'px-3 py-1.5 rounded inline-block w-fit mr-2 mt-4 text-slate-50 border-2 '
switch (itemName) { switch (itemName) {
case 'report': case 'report':
itemStyle += 'bg-green-400 text-slate-50' itemStyle += 'bg-green-500 border-green-500'
text = 'Report'
break break
case 'presentation': case 'presentation':
itemStyle += `bg-blue-400 text-slate-50` text = 'Presentation'
itemStyle += `bg-blue-500 border-blue-500`
break break
case 'white paper': case 'white paper':
itemStyle += `bg-fuchsia-700 text-slate-50` text = 'White Paper'
itemStyle += `bg-fuchsia-700 border-fuchsia-700`
break
case 'datasheet':
text = 'Datasheet'
itemStyle += 'bg-amber-600 border-amber-600'
break
case 'dwm':
text = 'DWM'
itemStyle += 'bg-rose-950 border-rose-950'
break break
case 'other': case 'other':
itemStyle += `bg-gray-400 text-slate-50` text = 'Other'
itemStyle += `bg-gray-400 border-gray-400`
break break
} }
return ( return <span className={itemStyle}>{text}</span>
<p className={itemStyle}>
{itemName.charAt(0).toUpperCase()}
{itemName.slice(1)}
</p>
)
} }
return ( return (
@ -115,7 +124,7 @@ export default function Page({
<div> <div>
<h1 <h1
className={` className={`
text-slate-800 font-bold text-5xl mb-8 text-slate-800 font-bold text-5xl mb-4
${zillaSlab.className} ${zillaSlab.className}
`} `}
> >
@ -129,7 +138,7 @@ export default function Page({
</span> </span>
</p> </p>
{generateItemBadge(type)} {generateItemBadge(type)}
<p className='inline-block border-gray-200 border-2 rounded px-2 py-1'> <p className='inline-block border-gray-200 border-2 rounded px-2 py-1.5'>
Revision {latest} Revision {latest}
</p> </p>
<hr className='my-4' /> <hr className='my-4' />