added some prop interfaces

This commit is contained in:
shams mosowi
2019-09-23 07:39:06 +10:00
parent 1b1e0ce1bc
commit 7f6dc8cef7
5 changed files with 39 additions and 6 deletions

View File

@@ -3,12 +3,18 @@ import React from "react";
import { Checkbox } from "@material-ui/core";
// TODO: Create an interface for props
const CheckBox = (props: any) => {
interface Props {
value: boolean | null;
row: any;
onSubmit: Function;
}
const CheckBox = (props: Props) => {
const { value, row, onSubmit } = props;
return (
<Checkbox
name={`checkBox-controlled-${row.id}`}
checked={value}
checked={!!value}
onChange={e => {
onSubmit(row.ref, !value);
}}

View File

@@ -11,7 +11,14 @@ import {
} from "@material-ui/pickers";
// TODO: Create an interface for props
const Date = (props: any) => {
interface Props {
value: firebase.firestore.Timestamp | null;
row: any;
onSubmit: Function;
fieldType: FieldType;
}
const Date = (props: Props) => {
const { value, row, onSubmit, fieldType } = props;
function handleDateChange(date: Date | null) {
if (date) {

View File

@@ -2,8 +2,19 @@ import React, { useCallback, useState } from "react";
import { useDropzone } from "react-dropzone";
import useUploader from "../../hooks/useFiretable/useUploader";
// TODO: indecate state completion / error
import { FieldType } from '.';
// TODO: indicate state completion / error
// TODO: Create an interface for props
interface Props {
value: any;
row: any;
onSubmit: Function;
fieldType: FieldType;
}
const Image = (props: any) => {
const { columnData, cellData, cellActions, rowData, rowIndex } = props;
const [uploaderState, upload] = useUploader();

View File

@@ -2,6 +2,12 @@ import React from "react";
import ExpandIcon from "@material-ui/icons/AspectRatio";
import IconButton from "@material-ui/core/IconButton";
interface Props {
value: firebase.firestore.Timestamp | null;
row: any;
onSubmit: Function;
}
const UrlLink = (props: any) => {
const { value, cellActions } = props;
return value ? (

View File

@@ -2,9 +2,12 @@ import React from "react";
import EditIcon from "@material-ui/icons/Edit";
// TODO: regex validating url
// ^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$
interface Props {
value: string | null;
}
const UrlLink = (props: any) => {
const { value, cellActions } = props;
const UrlLink = (props: Props) => {
const { value } = props;
return value ? (
<>
<EditIcon />