@@ -22,9 +22,8 @@ interface PartData extends StyleData {
22
22
interface Props {
23
23
component : unknown ,
24
24
base ?: StyleData ,
25
- shadow ?: boolean ,
26
25
}
27
- export function TextComponent ( { component, base = { color : 'white' } , shadow = true } : Props ) {
26
+ export function TextComponent ( { component, base = { color : 'white' } } : Props ) {
28
27
const { version } = useVersion ( )
29
28
const { lang } = useLocale ( )
30
29
@@ -38,12 +37,7 @@ export function TextComponent({ component, base = { color: 'white' }, shadow = t
38
37
const { value : language } = useAsync ( ( ) => getLanguage ( version , lang ) , [ version , lang ] )
39
38
40
39
return < div class = "text-component" >
41
- { shadow && < div >
42
- { parts . map ( p => < TextPart part = { p } shadow = { true } lang = { language ?? { } } /> ) }
43
- </ div > }
44
- < div class = "text-foreground" >
45
- { parts . map ( p => < TextPart part = { p } lang = { language ?? { } } /> ) }
46
- </ div >
40
+ { parts . map ( p => < TextPart part = { p } lang = { language ?? { } } /> ) }
47
41
</ div >
48
42
}
49
43
@@ -89,7 +83,7 @@ function inherit(component: object, base: PartData) {
89
83
}
90
84
}
91
85
92
- const TextColors = {
86
+ const TextColors : Record < string , [ string , string ] > = {
93
87
black : [ '#000' , '#000' ] ,
94
88
dark_blue : [ '#00A' , '#00002A' ] ,
95
89
dark_green : [ '#0A0' , '#002A00' ] ,
@@ -108,15 +102,12 @@ const TextColors = {
108
102
white : [ '#FFF' , '#3F3F3F' ] ,
109
103
}
110
104
111
- type TextColorKey = keyof typeof TextColors
112
- const TextColorKeys = Object . keys ( TextColors )
113
-
114
- function TextPart ( { part, shadow, lang } : { part : PartData , shadow ?: boolean , lang : Record < string , string > } ) {
105
+ function TextPart ( { part, lang } : { part : PartData , lang : Record < string , string > } ) {
115
106
if ( part . translate ) {
116
107
const str = resolveTranslate ( part . translate , part . fallback , part . with , lang )
117
- return < span style = { createStyle ( part , shadow ) } > { str } </ span >
108
+ return < span style = { createStyle ( part ) } > { str } </ span >
118
109
}
119
- return < span style = { createStyle ( part , shadow ) } > { part . text } </ span >
110
+ return < span style = { createStyle ( part ) } > { part . text } </ span >
120
111
}
121
112
122
113
function resolveTranslate ( translate : string , fallback : string | undefined , with_ : any [ ] | undefined , lang : Record < string , string > ) : string {
@@ -131,11 +122,10 @@ function resolveTranslate(translate: string, fallback: string | undefined, with_
131
122
return replaceTranslation ( str , params )
132
123
}
133
124
134
- function createStyle ( style : StyleData , shadow ?: boolean ) {
125
+ function createStyle ( style : StyleData ) {
135
126
return {
136
- color : style . color && ( TextColorKeys . includes ( style . color )
137
- ? TextColors [ style . color as TextColorKey ] [ shadow ? 1 : 0 ]
138
- : shadow ? 'transparent' : style . color ) ,
127
+ color : style . color ? ( TextColors [ style . color ] ?. [ 0 ] ?? style . color ) : undefined ,
128
+ '--shadow-color' : style . color ? TextColors [ style . color ] ?. [ 1 ] : undefined ,
139
129
fontWeight : ( style . bold === true ) ? 'bold' : undefined ,
140
130
fontStyle : ( style . italic === true ) ? 'italic' : undefined ,
141
131
textDecoration : ( style . underlined === true )
0 commit comments