Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfd8dd6a

Browse files
committed
dynamic routing directories made, figuring out async funcs
1 parentd5cb25e commitfd8dd6a

File tree

4 files changed

+36
-32
lines changed

4 files changed

+36
-32
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"title" :"Test article 1",
3+
"author" :"The Author!",
4+
"date" :"1st July 2025"
5+
}
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
Just a*link*:**bold** ;haoklsdnkwajdaswDa
1+
*random text*
2+
**dwa**
23

34

4-
5-
random text
6-
5+
daw
6+
da
7+
wd
8+
aw
9+
d
10+
a
11+
dwadkioa;dw

‎frontend/src/components/Media/article-template.tsx‎

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,52 @@
11
importReactMarkdownfrom'react-markdown'
22
importremarkGfmfrom'remark-gfm'
3-
importmdcontentfrom'../../../public/articles/test-article/content.md'
43
importReact,{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

146
exportdefaultfunctionArticle({articleName} :{articleName :string}){
7+
158
const[markdown,setMarkdown]=useState("");
169

1710
useEffect(()=>{
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+
constarticleUrl="/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+
2328
return(
2429
<articleclassName="mt-[6px]">
2530
<headerclassName="mb-[6vmin] w-[100vmin] justify-self-center">
2631
<divclassName="mb-[6vmin] w-[120vmin] justify-self-center">
27-
<imgsrc="/articles/test-article/cover.png"/>
32+
<imgsrc={articleUrl+"/cover.png"}/>
2833
</div>
2934
{/* title, author, date */}
3035
<divclassName="">
3136
<divclassName="mb-[16px]">
3237
Articles
3338
</div>
3439
<h1className="font-black xl:text-6xl text-xl">
35-
Title of Article
40+
{infoObj}
41+
TITLE
3642
</h1>
3743
<divclassName="mt-[24px] flex">
3844
<divclassName="inline-flex">
39-
<imgsrc="/articles/test-article/author.jpg"className="inline ml-[4px] mr-[14px] w-[56px] h-[56px] rounded-full"/>
45+
<imgsrc={articleUrl+"/author.jpg"}className="inline ml-[4px] mr-[14px] w-[56px] h-[56px] rounded-full"/>
4046
</div>
4147
<divclassName="inline-flex flex-col self-center">
4248
<pclassName="font-bold self-start">
43-
Author Name
49+
{articleUrl+"/info.json"}
4450
</p>
4551
<pclassName="self-end">
4652
the date is blah blah blah
@@ -51,7 +57,9 @@ export default function Article( {articleName} : {articleName : string} ) {
5157
</header>
5258
<sectionclassName="w-[100vmin] justify-self-center pb-[75px]">
5359
<aclassName="font l:text-3xl text-xl">
54-
<ReactMarkdownremarkPlugins={[remarkGfm]}children={markdown}/>
60+
<ReactMarkdown>
61+
{markdown}
62+
</ReactMarkdown>
5563
</a>
5664
</section>
5765
</article>

‎frontend/src/pages/media/test-article.tsx‎

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp