File tree Expand file tree Collapse file tree 8 files changed +196
-59
lines changed Expand file tree Collapse file tree 8 files changed +196
-59
lines changed Original file line number Diff line number Diff line change 1
- .blog-icon {
2
- color : white;
3
- font-family : Verdana;
4
- font-size : 12px ;
5
- background-color : var (--main-2 );
6
- border-radius : 4px ;
7
- padding : 5px ;
8
- font-weight : 700 ;
9
- height : 18px ;
10
- position : relative;
11
- top : -8px ;
12
- }
13
-
14
- # App .context {
15
- max-width : 800px ;
16
- min-width : 600px ;
17
- margin : 0 auto;
18
- position : relative;
19
- }
20
-
21
- # App h1 {
22
- font-size : 32px ;
1
+ # App a {
2
+ color : var (--main-2 );
23
3
}
24
-
25
- # App h1 img {
26
- display : inline;
27
- height : 36px ;
28
- padding-bottom : 6px ;
29
- padding-right : 6px ;
4
+
5
+ # App a : link {
6
+ text-decoration : none;
30
7
}
31
8
32
- # App .home-page-title {
33
- color : var (--text-1 );
34
- text-decoration : none;
9
+ # App small {
10
+ color : var (--text-2 );
35
11
}
36
12
37
13
# App ol {
54
30
padding-left : 40px ;
55
31
}
56
32
57
- # App a {
58
- color : var (--main-2 );
59
- }
60
-
61
- # App a : link {
62
- text-decoration : none;
63
- }
64
-
65
- # App small {
66
- color : var (--text-2 );
33
+ .context {
34
+ max-width : 800px ;
35
+ min-width : 600px ;
36
+ margin : 0 auto;
37
+ position : relative;
67
38
}
68
39
69
40
@media screen and (max-width : 768px ) {
70
- # App .context {
41
+ .context {
71
42
width : 100% ;
72
43
margin : 0 auto;
73
44
position : relative;
76
47
}
77
48
78
49
@media screen and (max-width : 576px ) {
79
- # App .context {
50
+ .context {
80
51
margin-left : 0px ;
81
52
box-sizing : border-box;
82
53
max-width : 576px ;
Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ import React from 'react'
2
2
import { useState , useEffect , useContext } from 'react'
3
3
import './App.css' ;
4
4
import { AppStateContext } from './index'
5
- import { BLOG_NAME } from './configs/general'
6
5
import PostBlock from './modules/PostBlock'
7
6
import Search from './modules/Search'
8
7
import MDPreviewer from './modules/MdRender/preview'
9
8
import { POST_PRE_PAGE } from './configs/general'
9
+ import Banner from './modules/Banner' ;
10
10
11
11
const axios = require ( 'axios' ) ;
12
12
@@ -41,16 +41,10 @@ function App() {
41
41
42
42
return (
43
43
< div id = "App" >
44
- < div style = { { marginTop : 40 } } className = "text-center" >
45
- < h1 >
46
- < a href = "/" className = "home-page-title font-medium" >
47
- < img src = "/icon.svg" alt = "" srcSet = "" />
48
- { BLOG_NAME }
49
- </ a >
50
- </ h1 >
51
- < small > 程式技術、自然語言處理和論文筆記</ small >
44
+
45
+ < Banner >
52
46
< Search setPosts = { setPosts } fullIndex = { fullIndex } />
53
- </ div >
47
+ </ Banner >
54
48
55
49
< div className = "context" >
56
50
{ posts . map ( ( post , i ) => (
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import reportWebVitals from './reportWebVitals';
7
7
import LoadingView from './modules/Loading'
8
8
import CornerMenu from './modules/CornerMenu'
9
9
import Footer from './modules/Footer'
10
+ import Archive from './modules/Archive'
10
11
import { BLOG_NAME } from './configs/general'
11
12
import MdRender from './modules/MdRender' ;
12
13
import { Helmet } from 'react-helmet'
@@ -36,12 +37,21 @@ function Index() {
36
37
</ div >
37
38
)
38
39
}
40
+ else if ( page === "archive" ) {
41
+ pageContext = (
42
+ < div >
43
+ < Archive />
44
+ < CornerMenu />
45
+ < Footer />
46
+ </ div >
47
+ )
48
+ }
39
49
else if ( page === "code-404" ) {
40
50
pageContext = (
41
- < div className = 'flex flex-col p-2' >
42
- < p > 很抱歉,您要求的文章不存在。</ p >
43
- < p > < a style = { { color :'blue' , textDecoration :'underline' } } href = '/' > 回首頁</ a > </ p >
44
- </ div >
51
+ < div className = 'flex flex-col p-2' >
52
+ < p > 很抱歉,您要求的文章不存在。</ p >
53
+ < p > < a style = { { color : 'blue' , textDecoration : 'underline' } } href = '/' > 回首頁</ a > </ p >
54
+ </ div >
45
55
)
46
56
}
47
57
else {
Original file line number Diff line number Diff line change
1
+ # Archive p {
2
+ color : var (--text-1 );
3
+ white-space : nowrap; /* 不換行 */
4
+ overflow : hidden; /* 隱藏超出範圍的內容 */
5
+ text-overflow : ellipsis; /* 顯示省略號 */
6
+ width : 100% ; /* 設定固定寬度 */
7
+ line-height : 20px ;
8
+ }
9
+
10
+ # Archive small {
11
+ color : var (--text-2 );
12
+ margin-right : 5px ;
13
+ }
14
+
15
+ # Archive .row {
16
+ margin-bottom : 12px ;
17
+ }
18
+
19
+ # Archive a {
20
+ color : var (--main-2 );
21
+ }
22
+
23
+ # Archive a : link {
24
+ text-decoration : none;
25
+ }
26
+
27
+ # Archive small {
28
+ color : var (--text-2 );
29
+ }
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import Banner from '../Banner'
3
+ import { useState , useEffect , useContext } from 'react'
4
+ import { AppStateContext } from '../../index'
5
+ import './index.css'
6
+ const axios = require ( 'axios' )
7
+
8
+ function Archive ( ) {
9
+ let [ posts , setPosts ] = useState ( [ ] )
10
+ let appState = useContext ( AppStateContext )
11
+ let fetchPost = ( ) => {
12
+ appState . setLoading ( true )
13
+ axios . get ( "/index.json" )
14
+ . then ( ( res ) => {
15
+ posts = res . data
16
+ setPosts ( posts )
17
+ } )
18
+ . catch ( ( err ) => {
19
+ console . log ( err )
20
+ } )
21
+ . then ( ( ) => {
22
+ appState . setLoading ( false )
23
+ } )
24
+ }
25
+
26
+ useEffect ( ( ) => {
27
+ fetchPost ( )
28
+
29
+ // eslint-disable-next-line
30
+ } , [ ] )
31
+
32
+ return (
33
+ < div id = "Archive" >
34
+ < Banner />
35
+
36
+ < div className = "context" >
37
+ {
38
+ posts . map ( ( post , index ) => {
39
+ return < div key = { index } >
40
+ < div className = 'row' >
41
+ < p > < b > { post . date } </ b > - < a href = { post . page_link } > { post . title } </ a > </ p >
42
+ { post . tags . map ( ( tag ) => < small > #{ tag } </ small > ) }
43
+ </ div >
44
+ </ div >
45
+ } )
46
+ }
47
+ </ div >
48
+
49
+ </ div >
50
+ )
51
+ }
52
+
53
+ export default Archive
Original file line number Diff line number Diff line change
1
+ # Banner {
2
+ margin-bottom : 10px ;
3
+ }
4
+ # Banner .blog-icon {
5
+ color : white;
6
+ font-size : 12px ;
7
+ background-color : var (--main-2 );
8
+ border-radius : 4px ;
9
+ padding : 5px ;
10
+ font-weight : 700 ;
11
+ height : 18px ;
12
+ position : relative;
13
+ top : -8px ;
14
+ }
15
+
16
+ # Banner h1 {
17
+ font-size : 32px ;
18
+ }
19
+
20
+ # Banner h1 img {
21
+ display : inline;
22
+ height : 36px ;
23
+ padding-bottom : 6px ;
24
+ padding-right : 6px ;
25
+ }
26
+
27
+ # Banner .home-page-title {
28
+ color : var (--text-1 );
29
+ text-decoration : none;
30
+ }
31
+
32
+ # Banner a {
33
+ color : var (--main-2 );
34
+ }
35
+
36
+ # Banner a : link {
37
+ text-decoration : none;
38
+ }
39
+
40
+ # Banner small {
41
+ color : var (--text-2 );
42
+ }
43
+
44
+ # Banner small .spec-page {
45
+ color : var (--text-2 );
46
+ margin-left : 3px ;
47
+ margin-right : 3px ;
48
+ }
49
+
50
+ # Banner small .spec-page a {
51
+ color : var (--text-2 );
52
+ }
53
+
54
+ # Banner span .sep ::before {
55
+ content : '·' ;
56
+ color : var (--text-2 );
57
+ }
Original file line number Diff line number Diff line change
1
+ import { React } from 'react'
2
+ import { BLOG_NAME } from '../../configs/general'
3
+ import './index.css'
4
+
5
+ function Banner ( props ) {
6
+ return (
7
+ < div id = "Banner" style = { { marginTop : 20 } } className = "text-center" >
8
+ < h1 >
9
+ < a href = "/" className = "home-page-title font-medium" >
10
+ < img src = "/icon.svg" alt = "" srcSet = "" />
11
+ { BLOG_NAME }
12
+ </ a >
13
+ </ h1 >
14
+ < small > 程式技術、自然語言處理和論文筆記</ small >
15
+ < br />
16
+ { props . children }
17
+ < small className = 'spec-page' > < a href = "/?page=archive" > Archive</ a > </ small >
18
+ </ div >
19
+ )
20
+ }
21
+
22
+ export default Banner
Original file line number Diff line number Diff line change 1
1
# Search-Bar {
2
2
margin-top : 16px ;
3
- margin-bottom : 32px ;
3
+ /* margin-bottom: 32px; */
4
4
background-color : var (--main-bg-1 );
5
5
}
6
6
7
7
# Search-Bar input [type = text ] {
8
8
border-color : var (--support-1 );
9
9
border-style : solid;
10
10
border-width : 0px 0px 1px 0px ;
11
- height : 24px ;
11
+ height : 30px ;
12
+ text-align : center;
12
13
padding-left : 5px ;
13
14
margin-right : 5px ;
14
15
background-color : var (--main-bg-1 );
You can’t perform that action at this time.
0 commit comments