File tree Expand file tree Collapse file tree 11 files changed +105
-134
lines changed
Expand file tree Collapse file tree 11 files changed +105
-134
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import { Typography , List } from "antd" ;
2+ import { useNavigate } from "react-router-dom" ;
3+ import { memo } from "react" ;
4+ interface IProps {
5+ item : {
6+ title : string ;
7+ download_url : string ;
8+ path : string ;
9+ } ;
10+ }
11+ function ArticleLink ( { item } : IProps ) {
12+ const nav = useNavigate ( ) ;
13+ return (
14+ < List . Item >
15+ < Typography . Link
16+ onClick = { ( ) => {
17+ nav ( `/user/write` , {
18+ state : {
19+ url : item . download_url ,
20+ title : item . title ,
21+ path : item . path ,
22+ } ,
23+ } ) ;
24+ } }
25+ >
26+ { item . title }
27+ </ Typography . Link >
28+ </ List . Item >
29+ ) ;
30+ }
31+
32+ export default memo ( ArticleLink ) ;
Original file line number Diff line number Diff line change 1+ import { List , Skeleton } from "antd" ;
2+ import { memo } from "react" ;
3+ import ArticleLink from "../articleLink" ;
4+
5+ function ArticleList ( { postList } : any ) {
6+ return postList ?. length ? (
7+ < List
8+ size = "large"
9+ bordered
10+ dataSource = { postList }
11+ renderItem = { ( item : any ) => < ArticleLink item = { item } /> }
12+ />
13+ ) : (
14+ < Skeleton />
15+ ) ;
16+ }
17+
18+ export default memo ( ArticleList ) ;
Original file line number Diff line number Diff line change 1- export { default as ArticleCom } from "./articleCom" ;
1+ export { default as ArticleLink } from "./articleLink" ;
2+ export { default as ArticleList } from "./articleList" ;
Original file line number Diff line number Diff line change 33 height : 64px ;
44 }
55}
6- .bigMe {
7- position : absolute ;
8- bottom : 0 ;
9- right : 16px ;
10- width : 200px ;
11- height : 100px ;
12- background-repeat : no-repeat ;
13- background-image : url(" ../../assets/me.png" ) ;
14- background-size : 100% ;
15- }
Original file line number Diff line number Diff line change 11import { useEffect } from "react" ;
2- import { List , Typography } from "antd" ;
32import { post } from "@/utils/request" ;
43import style from "./index.module.less" ;
54import useCustomReducer from "@/hooks/useCusReducer" ;
6- import { useNavigate } from "react-router-dom " ;
5+ import ArticleList from "@/components/articleList " ;
76export default function AI ( ) {
8- const nav = useNavigate ( ) ;
97 const [ state , dispatch ] = useCustomReducer ( {
108 article : [ ] ,
119 } ) ;
@@ -21,25 +19,7 @@ export default function AI() {
2119 } , [ ] ) ;
2220 return (
2321 < div className = { style . aiContainer } >
24- < List
25- size = "large"
26- bordered
27- dataSource = { state . article }
28- renderItem = { ( item : any ) => (
29- < List . Item >
30- < Typography . Link
31- onClick = { ( ) => {
32- nav ( `/user/write` , {
33- state : { url : item . download_url } ,
34- } ) ;
35- } }
36- >
37- { item . title }
38- </ Typography . Link >
39- </ List . Item >
40- ) }
41- />
42- < div className = { style . bigMe } />
22+ < ArticleList postList = { state . article } />
4323 </ div >
4424 ) ;
4525}
Original file line number Diff line number Diff line change 11import { useEffect } from "react" ;
2- import { List , Typography } from "antd" ;
32import style from "./index.module.less" ;
3+ import ArticleList from "@/components/articleList" ;
44import { post } from "@/utils/request" ;
55import useCustomReducer from "@/hooks/useCusReducer" ;
6- import { useNavigate } from "react-router-dom" ;
76export default function BFE ( ) {
8- const nav = useNavigate ( ) ;
97 const [ state , dispatch ] = useCustomReducer ( {
108 article : [ ] ,
119 } ) ;
@@ -23,24 +21,7 @@ export default function BFE() {
2321 } , [ ] ) ;
2422 return (
2523 < div className = { style . archWP } >
26- < List
27- size = "large"
28- bordered
29- dataSource = { state . article }
30- renderItem = { ( item : any ) => (
31- < List . Item >
32- < Typography . Link
33- onClick = { ( ) => {
34- nav ( `/user/write` , {
35- state : { url : item . download_url } ,
36- } ) ;
37- } }
38- >
39- { item . title }
40- </ Typography . Link >
41- </ List . Item >
42- ) }
43- />
24+ < ArticleList postList = { state . article } />
4425 </ div >
4526 ) ;
4627}
Original file line number Diff line number Diff line change 11import { useEffect } from "react" ;
2- import { List , Typography } from "antd" ;
32import style from "./index.module.less" ;
3+ import ArticleList from "@/components/articleList" ;
44import { post } from "@/utils/request" ;
55import useCustomReducer from "@/hooks/useCusReducer" ;
6- import { useNavigate } from "react-router-dom" ;
76export default function BFE ( ) {
8- const nav = useNavigate ( ) ;
97 const [ state , dispatch ] = useCustomReducer ( {
108 article : [ ] ,
119 } ) ;
@@ -21,24 +19,7 @@ export default function BFE() {
2119 } , [ ] ) ;
2220 return (
2321 < div className = { style . BEWP } >
24- < List
25- size = "large"
26- bordered
27- dataSource = { state . article }
28- renderItem = { ( item : any ) => (
29- < List . Item >
30- < Typography . Link
31- onClick = { ( ) => {
32- nav ( `/user/write` , {
33- state : { url : item . download_url } ,
34- } ) ;
35- } }
36- >
37- { item . title }
38- </ Typography . Link >
39- </ List . Item >
40- ) }
41- />
22+ < ArticleList postList = { state . article } />
4223 </ div >
4324 ) ;
4425}
Original file line number Diff line number Diff line change 11import { useEffect } from "react" ;
2- import { Typography , List } from "antd" ;
32import style from "./index.module.less" ;
3+ import ArticleList from "@/components/articleList" ;
44import { post } from "@/utils/request" ;
55import useCustomReducer from "@/hooks/useCusReducer" ;
6- import { useNavigate } from "react-router-dom" ;
76export default function BFE ( ) {
8- const nav = useNavigate ( ) ;
97 const [ state , dispatch ] = useCustomReducer ( {
108 article : [ ] ,
119 } ) ;
@@ -21,24 +19,7 @@ export default function BFE() {
2119 } , [ ] ) ;
2220 return (
2321 < div className = { style . BFEWP } >
24- < List
25- size = "large"
26- bordered
27- dataSource = { state . article }
28- renderItem = { ( item : any ) => (
29- < List . Item >
30- < Typography . Link
31- onClick = { ( ) => {
32- nav ( `/user/write` , {
33- state : { url : item . download_url } ,
34- } ) ;
35- } }
36- >
37- { item . title }
38- </ Typography . Link >
39- </ List . Item >
40- ) }
41- />
22+ < ArticleList postList = { state . article } />
4223 </ div >
4324 ) ;
4425}
You can’t perform that action at this time.
0 commit comments