fix @Vendicated insanities
This commit is contained in:
parent
3fb6b6e2c2
commit
ff61e5ea04
3 changed files with 25 additions and 20 deletions
|
@ -1,11 +1,11 @@
|
|||
import { ComponentTypes, ThumbnailComponent } from "oceanic.js";
|
||||
|
||||
export type ThumbnailProps = Omit<ThumbnailComponent, "type" | "media"> & { 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
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -8,11 +8,7 @@ import { User as DiscordUser } from "oceanic.js";
|
|||
export function User(props: { user: DiscordUser }) {
|
||||
const { user } = props;
|
||||
return (
|
||||
<Section
|
||||
accessory={
|
||||
<Thumbnail children={{ url: user.avatarURL("png", 128) }} />
|
||||
}
|
||||
>
|
||||
<Section accessory={<Thumbnail src={user.avatarURL("png", 128)} />}>
|
||||
<TextDisplay>### User</TextDisplay>
|
||||
<TextDisplay>
|
||||
{user.globalName || user.username}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue