fix: removed wrapping of text components for the description field
This commit is contained in:
parent
c9bd5ff983
commit
aa20bd1452
@ -3,7 +3,7 @@ import { useMemo } from "react";
|
|||||||
import { Mention } from "./mention";
|
import { Mention } from "./mention";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
export function Text({ content, tags }: { content: string; tags: Array<Array<string>> }) {
|
export function Text({ content, tags, wrap = true }: { content: string; tags: Array<Array<string>>; wrap?: boolean }) {
|
||||||
const frags = useMemo(() => transformText(content, tags), [content, tags]);
|
const frags = useMemo(() => transformText(content, tags), [content, tags]);
|
||||||
|
|
||||||
function renderFrag(f: ParsedFragment, index: number) {
|
function renderFrag(f: ParsedFragment, index: number) {
|
||||||
@ -29,5 +29,8 @@ export function Text({ content, tags }: { content: string; tags: Array<Array<str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wrap) {
|
||||||
return <div className="text">{frags.map(renderFrag)}</div>;
|
return <div className="text">{frags.map(renderFrag)}</div>;
|
||||||
}
|
}
|
||||||
|
return frags.map(renderFrag);
|
||||||
|
}
|
||||||
|
@ -89,7 +89,7 @@ export function TorrentDetail({ item }: { item: TaggedNostrEvent }) {
|
|||||||
<>
|
<>
|
||||||
<h3 className="mt-2">Description</h3>
|
<h3 className="mt-2">Description</h3>
|
||||||
<pre className="font-mono text-sm bg-neutral-900 p-4 rounded-lg overflow-y-auto">
|
<pre className="font-mono text-sm bg-neutral-900 p-4 rounded-lg overflow-y-auto">
|
||||||
<Text content={item.content} tags={item.tags}></Text>
|
<Text content={item.content} tags={item.tags} wrap={false}></Text>
|
||||||
</pre>
|
</pre>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user