Skip to content

Commit

Permalink
refactor: convert => TextItem
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed Nov 10, 2023
1 parent cc03518 commit f02b3c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"keywords": [
"saucer"
],
"version": "4.2.2",
"version": "4.2.3",
"license": "MIT",
"author": "Curve (https://github.com/Curve)",
"type": "module",
Expand Down
6 changes: 4 additions & 2 deletions src/components/line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface LineProps
text: string | ColoredText[];
}

function convert(item: ColoredText)
export function TextItem({ item }: {item: ColoredText})
{
if (typeof item === "string")
{
Expand All @@ -25,7 +25,9 @@ export function Line({ icon, text }: LineProps)
{" "}
{
Array.isArray(text) ?
text.map(convert) : convert(text)
text.map((item, index) => <TextItem key={index} item={item} />)
:
<TextItem item={text} />
}
</Text>;
}

0 comments on commit f02b3c8

Please sign in to comment.