Files
misode.github.io/src/app/components/ToolCard.tsx
Misode d0bae089d1 Improve homepage (#245)
* Improve how generators are listed on home

* Add some icons for generators

* Remove debug

* Refactor cachedFetch and use generated changelogs

* Add limit to how many changes are shown by default

* Add more generator icons

* Refactor cards

* Fix generator icons for light theme

* Add more worldgen icons

* Add remaining generator icons

* Refactor navigation and badges style

* Group on homepage for guides and tools

* Fix header button style

* Add versions and technical changelog to homepage

* Make it clear that not all changes could be documented
2022-07-01 23:48:38 +02:00

33 lines
801 B
TypeScript

import { Icons } from './Icons.js'
import { Octicon } from './Octicon.jsx'
interface Props {
title: string,
titleIcon?: keyof typeof Octicon | keyof typeof Icons,
link: string,
icon?: keyof typeof Icons,
desc?: string,
}
export function ToolCard({ title, desc, link, icon, titleIcon }: Props) {
if (icon || desc) {
return <a class="tool-card" href={link}>
{icon && Icons[icon]}
<div>
<ToolHead title={title} titleIcon={titleIcon} />
<p>{desc}</p>
</div>
</a>
}
return <a class="tool-card" href={link}>
<ToolHead title={title} titleIcon={titleIcon} />
</a>
}
function ToolHead({ title, titleIcon }: Pick<Props, 'title' | 'titleIcon'>) {
return <h3>
{title}
{titleIcon && (titleIcon in Octicon ? (Octicon as any)[titleIcon] : (Icons as any)[titleIcon])}
</h3>
}