Add locale

This commit is contained in:
Sakura Knoll
2023-07-15 11:02:48 +09:00 Unverified
parent f3a2b284bf
commit 361e32343f
17 changed files with 231 additions and 144 deletions
+9 -5
View File
@@ -16,11 +16,15 @@ const FormattedText = ({ children }: FormattedTextProps) => {
function renderTokens(tokens: FormattedTextToken[]) {
return tokens.map((token, index) => {
if (token.type === 'element') {
return (
<Text key={index} style={{ color: adjustColor(token.attributes.color) }}>
{renderTokens(token.children)}
</Text>
)
if (token.tagName === 'color') {
return (
<Text key={index} style={{ color: adjustColor(token.attributes.color) }}>
{renderTokens(token.children)}
</Text>
)
} else {
return <Text key={index}>{renderTokens(token.children)}</Text>
}
}
return token.text