fix: removed wrapping of text components for the description field

This commit is contained in:
florian 2023-12-19 15:28:53 +01:00
parent c9bd5ff983
commit aa20bd1452
2 changed files with 6 additions and 3 deletions

View File

@ -3,7 +3,7 @@ import { useMemo } from "react";
import { Mention } from "./mention";
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]);
function renderFrag(f: ParsedFragment, index: number) {
@ -29,5 +29,8 @@ export function Text({ content, tags }: { content: string; tags: Array<Array<str
}
}
return <div className="text">{frags.map(renderFrag)}</div>;
if (wrap) {
return <div className="text">{frags.map(renderFrag)}</div>;
}
return frags.map(renderFrag);
}

View File

@ -89,7 +89,7 @@ export function TorrentDetail({ item }: { item: TaggedNostrEvent }) {
<>
<h3 className="mt-2">Description</h3>
<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>
</>
)}