fix: note embed in cards
This commit is contained in:
@ -35,7 +35,7 @@ export function EventIcon({ kind }: { kind?: EventKind }) {
|
|||||||
export function NostrEvent({ ev }: { ev: TaggedNostrEvent }) {
|
export function NostrEvent({ ev }: { ev: TaggedNostrEvent }) {
|
||||||
const link = NostrLink.fromEvent(ev);
|
const link = NostrLink.fromEvent(ev);
|
||||||
function modalPage(inner: ReactNode) {
|
function modalPage(inner: ReactNode) {
|
||||||
return <div className="rounded-2xl px-4 py-3 md:w-[700px] mx-auto w-full">{inner}</div>;
|
return <div className="rounded-2xl px-4 py-3">{inner}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ev.kind) {
|
switch (ev.kind) {
|
||||||
@ -83,6 +83,8 @@ export function NostrEvent({ ev }: { ev: TaggedNostrEvent }) {
|
|||||||
export function EventEmbed({ link, ...props }: EventProps & HTMLProps<HTMLDivElement>) {
|
export function EventEmbed({ link, ...props }: EventProps & HTMLProps<HTMLDivElement>) {
|
||||||
const event = useEventFeed(link);
|
const event = useEventFeed(link);
|
||||||
if (event) {
|
if (event) {
|
||||||
return <NostrEvent ev={event} {...props} />;
|
return <div className="md:w-[700px] mx-auto w-full">
|
||||||
|
<NostrEvent ev={event} {...props} />
|
||||||
|
</div>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,19 @@
|
|||||||
import { NostrLink, TaggedNostrEvent } from "@snort/system";
|
import { NostrLink, TaggedNostrEvent } from "@snort/system";
|
||||||
|
|
||||||
import { ExternalIconLink } from "./external-link";
|
|
||||||
import { Profile } from "./profile";
|
import { Profile } from "./profile";
|
||||||
import EventReactions from "./event-reactions";
|
import EventReactions from "./event-reactions";
|
||||||
import { Text } from "@/element/text";
|
import { Text } from "@/element/text";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
import { Icon } from "./icon";
|
||||||
|
|
||||||
export function Note({ ev }: { ev: TaggedNostrEvent }) {
|
export function Note({ ev }: { ev: TaggedNostrEvent }) {
|
||||||
return (
|
return (
|
||||||
<div className="bg-layer-2 rounded-xl px-4 py-3 flex flex-col gap-2">
|
<div className="bg-layer-2 rounded-xl px-4 py-3 flex flex-col gap-2">
|
||||||
<div className="flex justify-between items-center">
|
<div className="flex justify-between items-center">
|
||||||
<Profile pubkey={ev.pubkey} avatarSize={30} />
|
<Profile pubkey={ev.pubkey} avatarSize={30} />
|
||||||
<ExternalIconLink size={24} href={`https://snort.social/${NostrLink.fromEvent(ev).encode()}`} />
|
<Link to={`/${NostrLink.fromEvent(ev).encode()}`}>
|
||||||
|
<Icon name="link" size={24} />
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<Text tags={ev.tags} content={ev.content} className="whitespace-pre-line overflow-wrap" />
|
<Text tags={ev.tags} content={ev.content} className="whitespace-pre-line overflow-wrap" />
|
||||||
<EventReactions ev={ev} />
|
<EventReactions ev={ev} />
|
||||||
|
Reference in New Issue
Block a user