mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-10 22:41:59 +00:00
84c3b039c3
* initial fixes: everything working except toasts and patch notes * tabshook changes, disable toaster for now * prettier * oops * implement custom toaster because I am tired of Valve's shit also fix QAM not injecting sometimes * remove extra logging * add findSP, fix patch notes, fix vscode screwup * fix patch notes * show error when plugin frontends fail to load * add get_tab_lambda * add css and has_element helpers to Tab * small modals fixup * Don't forceUpdate QuickAccess on stable * add routes prop used to get tabs component * add more dev utils to DFL global
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { Focusable, Router } from 'decky-frontend-lib';
|
|
import { FunctionComponent, useRef } from 'react';
|
|
import ReactMarkdown, { Options as ReactMarkdownOptions } from 'react-markdown';
|
|
import remarkGfm from 'remark-gfm';
|
|
|
|
interface MarkdownProps extends ReactMarkdownOptions {
|
|
onDismiss?: () => void;
|
|
}
|
|
|
|
const Markdown: FunctionComponent<MarkdownProps> = (props) => {
|
|
return (
|
|
<Focusable>
|
|
<ReactMarkdown
|
|
remarkPlugins={[remarkGfm]}
|
|
components={{
|
|
div: (nodeProps) => <Focusable {...nodeProps.node.properties}>{nodeProps.children}</Focusable>,
|
|
a: (nodeProps) => {
|
|
const aRef = useRef<HTMLAnchorElement>(null);
|
|
return (
|
|
// TODO fix focus ring
|
|
<Focusable
|
|
onActivate={() => {}}
|
|
onOKButton={() => {
|
|
props.onDismiss?.();
|
|
Router.NavigateToExternalWeb(aRef.current!.href);
|
|
}}
|
|
style={{ display: 'inline' }}
|
|
>
|
|
<a ref={aRef} {...nodeProps.node.properties}>
|
|
{nodeProps.children}
|
|
</a>
|
|
</Focusable>
|
|
);
|
|
},
|
|
}}
|
|
{...props}
|
|
/>
|
|
</Focusable>
|
|
);
|
|
};
|
|
|
|
export default Markdown;
|