generated from nhcarrigan/template
feat: render changelog as markdown in about panel (#33)
## Summary - Installs `react-markdown@10.1.0` in `apps/web` - Replaces the `<pre>` tag in the changelog section with the `<Markdown>` component for proper rendering - Updates CSS to style markdown elements (paragraphs, lists, headings, code blocks, links, bold text) Closes #31 ✨ This PR was created with help from Hikari~ 🌸 Reviewed-on: #33 Co-authored-by: Hikari <hikari@nhcarrigan.com> Co-committed-by: Hikari <hikari@nhcarrigan.com>
This commit was merged in pull request #33.
This commit is contained in:
@@ -13,7 +13,8 @@
|
||||
"dependencies": {
|
||||
"@elysium/types": "workspace:*",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0"
|
||||
"react-dom": "19.0.0",
|
||||
"react-markdown": "10.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nhcarrigan/eslint-config": "5.2.0",
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
/* eslint-disable max-lines-per-function -- HOW_TO_PLAY data and render logic */
|
||||
/* eslint-disable max-lines -- HOW_TO_PLAY data makes this file long */
|
||||
import { type JSX, useEffect, useState } from "react";
|
||||
import Markdown from "react-markdown";
|
||||
import { getAbout } from "../../api/client.js";
|
||||
import type { AboutResponse } from "@elysium/types";
|
||||
|
||||
@@ -331,7 +332,9 @@ const aboutPanel = (): JSX.Element => {
|
||||
</span>
|
||||
</button>
|
||||
{expandedRelease === release.tag_name
|
||||
&& <pre className="about-release-body">{release.body}</pre>
|
||||
&& <div className="about-release-body">
|
||||
<Markdown>{release.body}</Markdown>
|
||||
</div>
|
||||
}
|
||||
</li>
|
||||
);
|
||||
|
||||
+75
-3
@@ -2285,9 +2285,6 @@ body {
|
||||
}
|
||||
|
||||
.about-release-body {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
font-family: inherit;
|
||||
font-size: 0.85rem;
|
||||
color: var(--colour-text-secondary, #b0b0b0);
|
||||
padding: 0 1rem 0.75rem;
|
||||
@@ -2295,6 +2292,81 @@ body {
|
||||
border-top: 1px solid var(--colour-border, #0f3460);
|
||||
}
|
||||
|
||||
.about-release-body p {
|
||||
margin: 0.4rem 0;
|
||||
}
|
||||
|
||||
.about-release-body p:first-child {
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.about-release-body p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.about-release-body ul,
|
||||
.about-release-body ol {
|
||||
padding-left: 1.5rem;
|
||||
margin: 0.4rem 0;
|
||||
}
|
||||
|
||||
.about-release-body li {
|
||||
margin-bottom: 0.2rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.about-release-body h1,
|
||||
.about-release-body h2,
|
||||
.about-release-body h3,
|
||||
.about-release-body h4 {
|
||||
color: var(--colour-accent);
|
||||
font-size: 0.9rem;
|
||||
font-weight: bold;
|
||||
margin: 0.75rem 0 0.25rem;
|
||||
}
|
||||
|
||||
.about-release-body h1:first-child,
|
||||
.about-release-body h2:first-child,
|
||||
.about-release-body h3:first-child,
|
||||
.about-release-body h4:first-child {
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.about-release-body code {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border-radius: 3px;
|
||||
padding: 0.1em 0.3em;
|
||||
font-family: monospace;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.about-release-body pre {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
border-radius: 4px;
|
||||
padding: 0.75rem;
|
||||
overflow-x: auto;
|
||||
margin: 0.4rem 0;
|
||||
}
|
||||
|
||||
.about-release-body pre code {
|
||||
background: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.about-release-body a {
|
||||
color: var(--colour-accent-light);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.about-release-body a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.about-release-body strong {
|
||||
color: var(--colour-text);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.about-how-to-play {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
|
||||
Generated
+691
-17
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user