mirror of
https://github.com/kremalicious/blog.git
synced 2024-06-28 16:48:00 +02:00
Matthias Kretschmann
c123dd9d68
* astro-redirect-from prototype * move out plugin * switch to astro-redirect-from * fixes * new post: astro-redirect-from * fix dependency * test fixes * downgrade and lock astro * until fix for https://github.com/withastro/astro/issues/8649 has been released * mention debug json file * fix e2e test
51 lines
1.1 KiB
Plaintext
51 lines
1.1 KiB
Plaintext
---
|
|
import { markdownToHtml } from '@lib/markdown'
|
|
import { getRepo } from '@lib/github'
|
|
import styles from './index.module.css'
|
|
|
|
type Props = {
|
|
repo: string
|
|
}
|
|
|
|
const { repo } = Astro.props as Props
|
|
const repoInfo = await getRepo(repo)
|
|
if (!repoInfo) {
|
|
console.info(`Repo ${repo} not found`)
|
|
return
|
|
}
|
|
const { url, object } = repoInfo
|
|
const changelogHtml = await markdownToHtml(
|
|
object.text.replace('### Changelog', '')
|
|
)
|
|
---
|
|
|
|
{
|
|
repoInfo ? (
|
|
<>
|
|
<h2>Changelog</h2>
|
|
<div class={styles.changelog} id="changelog">
|
|
<p class={styles.source}>
|
|
sourced from{' '}
|
|
<a href={`${url}/tree/main/CHANGELOG.md`}>
|
|
<code>{`${repo}:CHANGELOG.md`}</code>
|
|
</a>
|
|
</p>
|
|
<div class={styles.content} set:html={changelogHtml} />
|
|
</div>
|
|
<button class="link" id="changelog-all">
|
|
Show all
|
|
</button>
|
|
</>
|
|
) : null
|
|
}
|
|
|
|
<script>
|
|
const changelog = document.querySelector('#changelog')
|
|
const button = document.querySelector('#changelog-all')
|
|
|
|
button?.addEventListener('click', () => {
|
|
changelog?.classList.add('all')
|
|
button?.remove()
|
|
})
|
|
</script>
|