11import ReactMarkdown from 'react-markdown'
22import remarkGfm from 'remark-gfm'
3- import mdcontent from '../../../public/articles/test-article/content.md'
43import React , { useState , useEffect } from "react" ;
54
6- // const markdown =
7- // `HELLO THIS IS *MARKDOWN*
8-
9- // **BOLD TEXT**
10-
11- // ***bold Italics***
12- // # heAdINg TeSt`
135
146export default function Article ( { articleName} :{ articleName :string } ) {
7+
158const [ markdown , setMarkdown ] = useState ( "" ) ;
169
1710useEffect ( ( ) => {
18- fetch ( '../../../public /articles/test-article/content.md' )
11+ fetch ( '/articles/test-article/content.md' )
1912. then ( ( res ) => res . text ( ) )
2013. then ( ( text ) => setMarkdown ( text ) ) ;
2114} , [ ] ) ;
2215
16+ const articleUrl = "/articles/" + articleName
17+
18+ const [ infoObj , setInfo ] = useState ( "" ) ;
19+
20+ useEffect ( ( ) => {
21+ fetch ( '/articles/test-article/info.json' )
22+ . then ( ( res ) => res . text ( ) )
23+ . then ( ( text ) => setInfo ( text ) ) ;
24+ } , [ ] ) ;
25+
26+ // const obj = JSON.parse(infoObj)
27+
2328return (
2429< article className = "mt-[6px]" >
2530< header className = "mb-[6vmin] w-[100vmin] justify-self-center" >
2631< div className = "mb-[6vmin] w-[120vmin] justify-self-center" >
27- < img src = "/articles/test-article/ cover.png"/>
32+ < img src = { articleUrl + "/ cover.png"} />
2833</ div >
2934{ /* title, author, date */ }
3035< div className = "" >
3136< div className = "mb-[16px]" >
3237 Articles
3338</ div >
3439< h1 className = "font-black xl:text-6xl text-xl" >
35- Title of Article
40+ { infoObj }
41+ TITLE
3642</ h1 >
3743< div className = "mt-[24px] flex" >
3844< div className = "inline-flex" >
39- < img src = "/articles/test-article/ author.jpg"className = "inline ml-[4px] mr-[14px] w-[56px] h-[56px] rounded-full" />
45+ < img src = { articleUrl + "/ author.jpg"} className = "inline ml-[4px] mr-[14px] w-[56px] h-[56px] rounded-full" />
4046</ div >
4147< div className = "inline-flex flex-col self-center" >
4248< p className = "font-bold self-start" >
43- Author Name
49+ { articleUrl + "/info.json" }
4450</ p >
4551< p className = "self-end" >
4652 the date is blah blah blah
@@ -51,7 +57,9 @@ export default function Article( {articleName} : {articleName : string} ) {
5157</ header >
5258< section className = "w-[100vmin] justify-self-center pb-[75px]" >
5359< a className = "font l:text-3xl text-xl" >
54- < ReactMarkdown remarkPlugins = { [ remarkGfm ] } children = { markdown } />
60+ < ReactMarkdown >
61+ { markdown }
62+ </ ReactMarkdown >
5563</ a >
5664</ section >
5765</ article >