fix providers page
This commit is contained in:
5 files changed
+92
-55
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import type {Providers, HostingProvider, ProviderType} from "@site/src/types/providers";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
|
||||
export const noP = (props: { children: any; }) => {
|
||||
const { children } = props;
|
||||
return children;
|
||||
}
|
||||
|
||||
export const Provider = ({type}) => {
|
||||
const data: Providers = require('@site/_data/providers.json')
|
||||
const providers: HostingProvider[] = data[type as ProviderType]
|
||||
|
||||
console.log(data, type, providers)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ul>{providers.map((provider: HostingProvider) => (
|
||||
<li>
|
||||
<a href={provider.url}>{provider.name}</a>
|
||||
{provider.description != null || provider.description_template != null ? (
|
||||
<ReactMarkdown children={` ‐ ${data.description_templates[provider.description_template] || ''} ${provider.description || ''}`} components={{p: noP}} />
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
</li>
|
||||
))}</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
export type HostingProvider = {
|
||||
name: string;
|
||||
url: string;
|
||||
description?: string;
|
||||
description_template?: "default" | "ip_and_port" | "forwarding_option" | "java_ip";
|
||||
}
|
||||
|
||||
export type ProviderType = "built_in" | "support" | "no_support";
|
||||
|
||||
export type Providers = {
|
||||
description_templates: {
|
||||
default: string;
|
||||
ip_and_port: string;
|
||||
forwarding_option: string;
|
||||
java_ip: string;
|
||||
},
|
||||
built_in: HostingProvider[];
|
||||
support: HostingProvider[];
|
||||
no_support: HostingProvider[];
|
||||
}
|
||||
Reference in new issue
Block a user