diff --git a/components-jsx/Thumbnail.tsx b/components-jsx/Thumbnail.tsx index eb40075..07fb522 100644 --- a/components-jsx/Thumbnail.tsx +++ b/components-jsx/Thumbnail.tsx @@ -1,11 +1,11 @@ import { ComponentTypes, ThumbnailComponent } from "oceanic.js"; -export type ThumbnailProps = Omit & { children: ThumbnailComponent["media"]; }; - -export function Thumbnail({ children, ...props }: ThumbnailProps): ThumbnailComponent { - return { - type: ComponentTypes.THUMBNAIL, - media: children, - ...props - }; +export function Thumbnail(props: { src: string }): ThumbnailComponent { + return { + type: ComponentTypes.THUMBNAIL, + media: { + url: props.src + }, + ...props + }; } diff --git a/components-jsx/runtime.ts b/components-jsx/runtime.ts index 5b998b5..e1daaa6 100644 --- a/components-jsx/runtime.ts +++ b/components-jsx/runtime.ts @@ -1,13 +1,22 @@ +import { br } from "./br"; + export const Fragment = Symbol("ComponentsJsx.Fragment"); type FunctionComponent = (props: any) => any; -export function createElement(type: typeof Fragment | FunctionComponent, props: any, ...children: any[]) { - if (type === Fragment) { - return children; - } +export function createElement( + type: typeof Fragment | FunctionComponent, + props: any, + ...children: any[] +) { + if (type === Fragment) { + return children; + } - props ??= {}; - props.children = children; - return type(props); + props ??= {}; + props.children = children; + + // @ts-ignore + if (type === "br") return "\n"; + return type(props); } diff --git a/src/components/User.tsx b/src/components/User.tsx index 98ccf1d..6dcc149 100644 --- a/src/components/User.tsx +++ b/src/components/User.tsx @@ -8,11 +8,7 @@ import { User as DiscordUser } from "oceanic.js"; export function User(props: { user: DiscordUser }) { const { user } = props; return ( -
- } - > +
}> ### User {user.globalName || user.username}