1
1
import { Document } from "@/lib/@dsvgui" ;
2
- import { getTextWidth , hexToRgb } from "@/lib/@dsvgui/utils/index " ;
2
+ import { getTextWidth , hexToRgb } from "@/lib/@dsvgui/utils" ;
3
3
4
4
type ILineItem = {
5
5
leftTitle ?: string ;
@@ -64,21 +64,21 @@ export const Line: React.FC<ILine> = ({ items }) => {
64
64
const widths = items . map ( ( item ) => {
65
65
const leftTitleWidth = getTextWidth ( item . leftTitle || "" , {
66
66
fontSize : 22 ,
67
- ratio : 0.58 ,
67
+ fontWeight : "bolder" ,
68
68
} ) ;
69
69
const leftSubtitleWidth = getTextWidth ( item . leftSubtitle || "" , {
70
70
fontSize : 16 ,
71
- ratio : 0.57 ,
71
+ fontWeight : "500" ,
72
72
} ) ;
73
73
const leftTitlesWidth = Math . max ( leftTitleWidth , leftSubtitleWidth ) ;
74
74
75
75
const rightTitleWidth = getTextWidth ( item . rightTitle || "" , {
76
76
fontSize : 22 ,
77
- ratio : 0.58 ,
77
+ fontWeight : "bolder" ,
78
78
} ) ;
79
79
const rightSubtitleWidth = getTextWidth ( item . rightSubtitle || "" , {
80
80
fontSize : 16 ,
81
- ratio : 0.527 ,
81
+ fontWeight : "500" ,
82
82
} ) ;
83
83
const rightTitlesWidth = Math . max ( rightTitleWidth , rightSubtitleWidth ) ;
84
84
@@ -136,21 +136,14 @@ export const Line: React.FC<ILine> = ({ items }) => {
136
136
strokeLinejoin = "round"
137
137
/>
138
138
< g id = "left" >
139
- < text
140
- xmlSpace = "preserve"
141
- fontFamily = "Roboto"
142
- className = "title"
143
- fontWeight = "bolder"
144
- letterSpacing = "0.5px"
145
- >
139
+ < text xmlSpace = "preserve" className = "title" fontWeight = "bolder" >
146
140
< tspan x = "0" y = "15" >
147
141
{ item . leftTitle }
148
142
</ tspan >
149
143
</ text >
150
144
< text
151
145
fill = "#555555"
152
146
xmlSpace = "preserve"
153
- fontFamily = "Roboto"
154
147
className = "subtitle"
155
148
fontWeight = { 500 }
156
149
>
@@ -162,16 +155,15 @@ export const Line: React.FC<ILine> = ({ items }) => {
162
155
< g id = "right" >
163
156
< text
164
157
className = { [ "title" , `lineText_${ index } ` ] . join ( " " ) }
165
- fontWeight = "700 "
158
+ fontWeight = "bolder "
166
159
>
167
160
< tspan
168
161
x = {
169
162
width -
170
- getTextWidth ( item . rightTitle ?. replace ( / / g , "" ) || "" , {
163
+ getTextWidth ( item . rightTitle || "" , {
171
164
fontSize : 22 ,
172
- ratio : 0.5 ,
173
- } ) -
174
- documentPadding / 2
165
+ fontWeight : "bolder" ,
166
+ } )
175
167
}
176
168
y = "15"
177
169
>
@@ -180,14 +172,14 @@ export const Line: React.FC<ILine> = ({ items }) => {
180
172
</ text >
181
173
< text
182
174
className = { [ "subtitle" , `lineText_${ index } ` ] . join ( " " ) }
183
- fontWeight = { 300 }
175
+ fontWeight = { 500 }
184
176
>
185
177
< tspan
186
178
x = {
187
179
width -
188
180
getTextWidth ( item . rightSubtitle || "" , {
189
181
fontSize : 16 ,
190
- ratio : 0.5 ,
182
+ fontWeight : "500" ,
191
183
} )
192
184
}
193
185
y = "33"
@@ -204,19 +196,27 @@ export const Line: React.FC<ILine> = ({ items }) => {
204
196
205
197
{ index !== 0 && (
206
198
< rect
199
+ className = "divider"
207
200
x = "0"
208
201
y = { - rowGap / 2 }
209
202
width = { width }
210
203
height = { 1 }
211
204
rx = { 5 }
212
- fill = "#E4E4E4"
213
205
/>
214
206
) }
215
207
216
208
< defs >
217
209
< style > { `
218
210
.clabel{ fill: #999; font-size: 8px; }
219
211
.lineText_${ index } { fill: ${ item . lineColor } !important; }
212
+ .subtitle.lineText_${ index } { fill: rgba(${ hexToRgb (
213
+ item . lineColor || "#000000" ,
214
+ 0.6
215
+ ) . join ( ", " ) } ) !important; }
216
+ .divider { fill: #E4E4E4; }
217
+ @media (prefers-color-scheme: dark) {
218
+ .divider { fill: #333333; }
219
+ }
220
220
` } </ style >
221
221
< linearGradient
222
222
x1 = "0"
0 commit comments