add JSX components v2
This commit is contained in:
parent
b5dd0ed413
commit
4b1227149f
25 changed files with 1080 additions and 3 deletions
18
components-jsx/File.tsx
Normal file
18
components-jsx/File.tsx
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { ComponentTypes, FileComponent } from "oceanic.js";
|
||||
|
||||
import { MediaItem } from "./MediaItem";
|
||||
|
||||
interface FileProps {
|
||||
filename: string;
|
||||
id?: number;
|
||||
spoiler?: boolean;
|
||||
}
|
||||
|
||||
export function File({ filename, id, spoiler }: FileProps): FileComponent {
|
||||
return {
|
||||
type: ComponentTypes.FILE,
|
||||
id,
|
||||
spoiler,
|
||||
file: <MediaItem url={`attachment://${filename}`} />,
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue