UNPKG

1.01 kBTypeScriptView Raw
1import * as React from 'react';
2
3import Types from '../types';
4import { IComponent } from "../types/component";
5import { IInfrastructure } from "../types";
6
7export const FILE_INSTANCE_TYPE = "FileComponent";
8
9
10/**
11 * Arguments provided by the user
12 */
13export interface IFileArgs {
14 /**
15 * a unique id or name of the webapp
16 */
17 id: string,
18}
19
20/**
21 * properties added programmatically
22 */
23export interface IFileProps {
24
25}
26
27
28/**
29 * identifies a component as a File
30 *
31 * @param component to be tested
32 */
33export function isFile(component) {
34 return component !== undefined &&
35 component.instanceType === FILE_INSTANCE_TYPE
36}
37
38
39
40export default (props: IFileArgs | any) => {
41
42 const componentProps: IInfrastructure & IComponent = {
43 infrastructureType: Types.INFRASTRUCTURE_TYPE_COMPONENT,
44 instanceType: FILE_INSTANCE_TYPE,
45 instanceId: props.id
46 };
47
48 const fileProps: IFileProps = {
49
50 }
51
52 return Object.assign(props, componentProps, fileProps);
53
54
55};
\No newline at end of file