-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
196 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#Archive p { | ||
color: var(--text-1); | ||
white-space: nowrap; /* 不換行 */ | ||
overflow: hidden; /* 隱藏超出範圍的內容 */ | ||
text-overflow: ellipsis; /* 顯示省略號 */ | ||
width: 100%; /* 設定固定寬度 */ | ||
line-height: 20px; | ||
} | ||
|
||
#Archive small{ | ||
color: var(--text-2); | ||
margin-right: 5px; | ||
} | ||
|
||
#Archive .row{ | ||
margin-bottom: 12px; | ||
} | ||
|
||
#Archive a{ | ||
color: var(--main-2); | ||
} | ||
|
||
#Archive a:link{ | ||
text-decoration: none; | ||
} | ||
|
||
#Archive small{ | ||
color: var(--text-2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react' | ||
import Banner from '../Banner' | ||
import { useState, useEffect, useContext } from 'react' | ||
import { AppStateContext } from '../../index' | ||
import './index.css' | ||
const axios = require('axios') | ||
|
||
function Archive() { | ||
let [posts, setPosts] = useState([]) | ||
let appState = useContext(AppStateContext) | ||
let fetchPost = () => { | ||
appState.setLoading(true) | ||
axios.get("/index.json") | ||
.then((res) => { | ||
posts = res.data | ||
setPosts(posts) | ||
}) | ||
.catch((err) => { | ||
console.log(err) | ||
}) | ||
.then(() => { | ||
appState.setLoading(false) | ||
}) | ||
} | ||
|
||
useEffect(() => { | ||
fetchPost() | ||
|
||
// eslint-disable-next-line | ||
}, []) | ||
|
||
return ( | ||
<div id="Archive"> | ||
<Banner /> | ||
|
||
<div className="context"> | ||
{ | ||
posts.map((post, index) => { | ||
return <div key={index}> | ||
<div className='row'> | ||
<p><b>{post.date}</b> - <a href={post.page_link}>{post.title}</a></p> | ||
{post.tags.map((tag)=><small>#{tag}</small>)} | ||
</div> | ||
</div> | ||
}) | ||
} | ||
</div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
export default Archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#Banner { | ||
margin-bottom: 10px; | ||
} | ||
#Banner .blog-icon{ | ||
color: white; | ||
font-size: 12px; | ||
background-color: var(--main-2); | ||
border-radius: 4px; | ||
padding: 5px; | ||
font-weight: 700; | ||
height: 18px; | ||
position: relative; | ||
top: -8px; | ||
} | ||
|
||
#Banner h1 { | ||
font-size: 32px; | ||
} | ||
|
||
#Banner h1 img{ | ||
display: inline; | ||
height: 36px; | ||
padding-bottom: 6px; | ||
padding-right: 6px; | ||
} | ||
|
||
#Banner .home-page-title { | ||
color: var(--text-1); | ||
text-decoration: none; | ||
} | ||
|
||
#Banner a{ | ||
color: var(--main-2); | ||
} | ||
|
||
#Banner a:link{ | ||
text-decoration: none; | ||
} | ||
|
||
#Banner small{ | ||
color: var(--text-2); | ||
} | ||
|
||
#Banner small.spec-page{ | ||
color: var(--text-2); | ||
margin-left: 3px; | ||
margin-right: 3px; | ||
} | ||
|
||
#Banner small.spec-page a{ | ||
color: var(--text-2); | ||
} | ||
|
||
#Banner span.sep::before { | ||
content: '·'; | ||
color: var(--text-2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { React } from 'react' | ||
import { BLOG_NAME } from '../../configs/general' | ||
import './index.css' | ||
|
||
function Banner(props) { | ||
return ( | ||
<div id="Banner" style={{ marginTop: 20 }} className="text-center"> | ||
<h1> | ||
<a href="/" className="home-page-title font-medium"> | ||
<img src="/icon.svg" alt="" srcSet="" /> | ||
{BLOG_NAME} | ||
</a> | ||
</h1> | ||
<small>程式技術、自然語言處理和論文筆記</small> | ||
<br /> | ||
{props.children} | ||
<small className='spec-page'><a href="/?page=archive">Archive</a></small> | ||
</div> | ||
) | ||
} | ||
|
||
export default Banner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters