mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: render markdown
This commit is contained in:
@@ -32,12 +32,6 @@ import ConnectorsPage from "./pages/tracking/ConnectorsPage";
|
||||
import NotFoundPage from "./pages/NotFoundPage";
|
||||
import {ItemType, MenuItemType} from "antd/lib/menu/interface";
|
||||
|
||||
import tos from "./content/tos.md";
|
||||
import privacy from "./content/privacy.md";
|
||||
import home from './content/home.md'
|
||||
import faq from './content/faq.md'
|
||||
|
||||
|
||||
export default function App() {
|
||||
const {
|
||||
token: {colorBgContainer, borderRadiusLG},
|
||||
@@ -222,7 +216,7 @@ export default function App() {
|
||||
|
||||
<Routes>
|
||||
<Route path="/" element={<Navigate to="/login"/>}/>
|
||||
<Route path="/home" element={<TextPage markdown={home}/>}/>
|
||||
<Route path="/home" element={<TextPage resource='home.md'/>}/>
|
||||
|
||||
<Route path="/search/domain" element={<DomainSearchPage/>}/>
|
||||
<Route path="/search/entity" element={<EntitySearchPage/>}/>
|
||||
@@ -236,9 +230,9 @@ export default function App() {
|
||||
|
||||
<Route path="/user" element={<UserPage/>}/>
|
||||
|
||||
<Route path="/faq" element={<TextPage markdown={faq}/>}/>
|
||||
<Route path="/tos" element={<TextPage markdown={tos}/>}/>
|
||||
<Route path="/privacy" element={<TextPage markdown={privacy}/>}/>
|
||||
<Route path="/faq" element={<TextPage resource='faq.md'/>}/>
|
||||
<Route path="/tos" element={<TextPage resource='tos.md'/>}/>
|
||||
<Route path="/privacy" element={<TextPage resource='privacy.md'/>}/>
|
||||
|
||||
<Route path="/login" element={<LoginPage/>}/>
|
||||
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
import React from "react";
|
||||
import React, {useEffect, useState} from "react";
|
||||
import snarkdown from "snarkdown"
|
||||
import {Skeleton} from "antd";
|
||||
import axios from "axios";
|
||||
|
||||
export default function TextPage({markdown}: { markdown: string }) {
|
||||
return <div dangerouslySetInnerHTML={{__html: snarkdown(markdown)}}></div>
|
||||
export default function TextPage({resource}: { resource: string }) {
|
||||
const [markdown, setMarkdown] = useState<string>()
|
||||
|
||||
useEffect(() => {
|
||||
console.log('heyyy')
|
||||
axios.get('/content/' + resource).then(res => setMarkdown(res.data))
|
||||
}, [resource])
|
||||
|
||||
return <Skeleton loading={markdown === undefined} active>
|
||||
{markdown !== undefined && <div dangerouslySetInnerHTML={{__html: snarkdown(markdown)}}></div>}
|
||||
</Skeleton>
|
||||
}
|
||||
@@ -61,16 +61,6 @@ Encore
|
||||
|
||||
// uncomment if you use React
|
||||
.enableReactPreset()
|
||||
|
||||
.addLoader({
|
||||
test: /\.md$/,
|
||||
use: [
|
||||
{
|
||||
loader: "html-loader",
|
||||
}
|
||||
],
|
||||
})
|
||||
|
||||
// uncomment to get integrity="..." attributes on your script & link tags
|
||||
// requires WebpackEncoreBundle 1.4 or higher
|
||||
//.enableIntegrityHashes(Encore.isProduction())
|
||||
|
||||
Reference in New Issue
Block a user