mirror of
https://github.com/pawelmalak/flame.git
synced 2025-08-03 01:45:17 +02:00
Split categories and bookmarks forms into separate files. Added visibility functionality to categories and bookmarks
This commit is contained in:
parent
f127a354ef
commit
d83e3056c6
16 changed files with 484 additions and 369 deletions
44
client/src/components/Bookmarks/Form/Form.tsx
Normal file
44
client/src/components/Bookmarks/Form/Form.tsx
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Typescript
|
||||
import { Bookmark, Category } from '../../../interfaces';
|
||||
import { ContentType } from '../Bookmarks';
|
||||
|
||||
// Utils
|
||||
import { CategoryForm } from './CategoryForm';
|
||||
import { BookmarksForm } from './BookmarksForm';
|
||||
import { Fragment } from 'react';
|
||||
|
||||
interface Props {
|
||||
modalHandler: () => void;
|
||||
contentType: ContentType;
|
||||
inUpdate?: boolean;
|
||||
category?: Category;
|
||||
bookmark?: Bookmark;
|
||||
}
|
||||
|
||||
export const Form = (props: Props): JSX.Element => {
|
||||
const { modalHandler, contentType, inUpdate, category, bookmark } = props;
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
{!inUpdate ? (
|
||||
// form: add new
|
||||
<Fragment>
|
||||
{contentType === ContentType.category ? (
|
||||
<CategoryForm modalHandler={modalHandler} />
|
||||
) : (
|
||||
<BookmarksForm modalHandler={modalHandler} />
|
||||
)}
|
||||
</Fragment>
|
||||
) : (
|
||||
// form: update
|
||||
<Fragment>
|
||||
{contentType === ContentType.category ? (
|
||||
<CategoryForm modalHandler={modalHandler} category={category} />
|
||||
) : (
|
||||
<BookmarksForm modalHandler={modalHandler} bookmark={bookmark} />
|
||||
)}
|
||||
</Fragment>
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue