1
- import { Document } from "@/lib/@dsvgui" ;
1
+ import { Document , Text } from "@/lib/@dsvgui" ;
2
2
import { wrapText } from "@/lib/@dsvgui/utils" ;
3
3
import { getTextWidth } from "@/lib/@dsvgui/utils/index" ;
4
4
@@ -54,9 +54,9 @@ export const Article: React.FC<IArticle> = ({ articles }) => {
54
54
article . meta . title ,
55
55
{ maxLineWidth : titleWidth , fontSize : 16 , fontWeight : 700 } ,
56
56
( line : string , index : number ) => (
57
- < tspan key = { index } x = "0" dy = { index === 0 ? 0 : 25 } >
57
+ < Text x = { 0 } y = { index * 25 } option = { { size : 16 , weight : 700 } } >
58
58
{ line }
59
- </ tspan >
59
+ </ Text >
60
60
)
61
61
) ;
62
62
@@ -74,29 +74,24 @@ export const Article: React.FC<IArticle> = ({ articles }) => {
74
74
) }
75
75
< g transform = { `translate(0 ${ yOffset } )` } >
76
76
< g transform = { `translate(${ xOffset } 24)` } >
77
- < text
78
- xmlSpace = "preserve"
79
- fontWeight = "700"
80
- fill = "#0c0c0c"
81
- fontSize = "16"
82
- >
83
- { title }
84
- </ text >
85
- < text fill = "#999999" fontSize = { 12 } y = { 5 + title . length * 15 } >
86
- { wrapText (
87
- article . meta . description . replace ( / \n / gm, " " ) ,
88
- {
89
- maxLineWidth : titleWidth - 20 ,
90
- fontSize : 12 ,
91
- maxLines : 3 ,
92
- } ,
93
- ( line : string , index ) => (
94
- < tspan key = { index } x = "0" dy = { index === 0 ? 0 : 13 } >
95
- { line }
96
- </ tspan >
97
- )
98
- ) }
99
- </ text >
77
+ { title }
78
+ { wrapText (
79
+ article . meta . description . replace ( / \n / gm, " " ) ,
80
+ {
81
+ maxLineWidth : titleWidth - 20 ,
82
+ fontSize : 12 ,
83
+ maxLines : 3 ,
84
+ } ,
85
+ ( line : string , index ) => (
86
+ < Text
87
+ x = { 0 }
88
+ y = { 20 + title . length + index * 13 }
89
+ option = { { size : 12 , weight : 400 } }
90
+ >
91
+ { line }
92
+ </ Text >
93
+ )
94
+ ) }
100
95
</ g >
101
96
102
97
< g transform = { `translate(${ xOffset } 90)` } >
@@ -107,9 +102,9 @@ export const Article: React.FC<IArticle> = ({ articles }) => {
107
102
y = { - 11 }
108
103
fontSize = "15px"
109
104
/>
110
- < text fill = "#555" fontSize = "12" x = "3" y = "1" >
105
+ < Text x = { 3 } y = { 1 } option = { { size : 12 , weight : 500 } } >
111
106
{ article . publish_date }
112
- </ text >
107
+ </ Text >
113
108
</ g >
114
109
< g transform = { `translate(${ 15 + titleWidth / 4 } 0)` } >
115
110
< AiOutlineLike
@@ -118,9 +113,9 @@ export const Article: React.FC<IArticle> = ({ articles }) => {
118
113
y = { - 11 }
119
114
fontSize = "15px"
120
115
/>
121
- < text fill = "#555" fontSize = "12" x = "3" y = "1" >
122
- { article . like_count } likes
123
- </ text >
116
+ < Text x = { 3 } y = { 1 } option = { { size : 12 , weight : 500 } } >
117
+ { article . like_count }
118
+ </ Text >
124
119
</ g >
125
120
< g transform = { `translate(${ 15 + titleWidth / 2 } 0)` } >
126
121
< BiTimeFive
@@ -129,9 +124,9 @@ export const Article: React.FC<IArticle> = ({ articles }) => {
129
124
y = { - 11 }
130
125
fontSize = "15px"
131
126
/>
132
- < text fill = "#555" fontSize = "12" x = "3" y = "1" >
133
- { article . reading_time_minutes } mins
134
- </ text >
127
+ < Text x = { 3 } y = { 1 } option = { { size : 12 , weight : 500 } } >
128
+ { article . reading_time_minutes }
129
+ </ Text >
135
130
</ g >
136
131
< g transform = { `translate(${ 15 + ( titleWidth / 4 ) * 3 } 0)` } >
137
132
< IoPersonCircleOutline
@@ -140,9 +135,9 @@ export const Article: React.FC<IArticle> = ({ articles }) => {
140
135
y = { - 11 }
141
136
fontSize = "15px"
142
137
/>
143
- < text fill = "#555" fontSize = "12" x = "3" y = "1" >
138
+ < Text x = { 3 } y = { 1 } option = { { size : 12 , weight : 500 } } >
144
139
{ article . meta . author }
145
- </ text >
140
+ </ Text >
146
141
</ g >
147
142
</ g >
148
143
0 commit comments