mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 15:47:08 +00:00
* Add guides * Add versioning to guides * Guides: special variables and nested expressions * Add guides page to vite build * Add search and hash hooks, guide tags and headings * Improve guides list and filtering * Add 1.19 download link
26 lines
723 B
TypeScript
26 lines
723 B
TypeScript
import { ChangelogTag } from './versions'
|
|
|
|
interface Props {
|
|
title: string,
|
|
link: string,
|
|
versions: string[],
|
|
tags: string[],
|
|
activeTags?: string[],
|
|
toggleTag?: (tag: string) => unknown,
|
|
}
|
|
export function GuideCard({ title, link, versions, tags, activeTags, toggleTag }: Props) {
|
|
const onToggleTag = (tag: string) => (e: MouseEvent) => {
|
|
if (toggleTag) toggleTag(tag)
|
|
e.preventDefault()
|
|
e.stopImmediatePropagation()
|
|
}
|
|
|
|
return <a class="guide-card" href={link} >
|
|
<span class="guide-versions">{versions.join(' • ')}</span>
|
|
<h3>{title}</h3>
|
|
<div class="guide-tags">
|
|
{tags.sort().map(tag => <ChangelogTag label={tag} onClick={onToggleTag(tag)} active={activeTags?.includes(tag)} />)}
|
|
</div>
|
|
</a>
|
|
}
|