- implement lists

- implement generic sections
- implement list actions
- implement error handlers
This commit is contained in:
Amruth Pillai
2020-07-08 05:01:50 +05:30
parent d7e86ddf29
commit bee6a40e9f
38 changed files with 762 additions and 177 deletions

View File

@ -1,5 +1,5 @@
export const getModalText = (isEditMode, type) => {
return isEditMode ? `Edit ${type}` : `Create New ${type}`;
return isEditMode ? `Edit ${type}` : `Add ${type}`;
};
export const transformCollectionSnapshot = (snapshot, setData) => {
@ -7,3 +7,12 @@ export const transformCollectionSnapshot = (snapshot, setData) => {
snapshot.forEach((doc) => data.push(doc.data()));
setData(data);
};
export const handleKeyDown = (event, action) => {
event.which === 13 && action();
};
export const isFileImage = (file) => {
const acceptedImageTypes = ["image/jpeg", "image/png"];
return file && acceptedImageTypes.includes(file["type"]);
};