Project List
Project List is a component that shows the current projects of the user.
Project List consists of 3 sub-components:
Component
Project Header
Project Header contains the following sub-component:
-
Add Project Button
This button will call theopen
function of useProjectFormModal() to create a new project.
Project Filter
Project Filter contains the following sub-component:
-
Search Field
This field will set the value of
searchAtom
on event change. -
Layout Group Button
This group button will set the value of
viewType
using enum Layout./src/constants/layout.tsenum Layout {
Grid: 'grid'
List: 'list'
}warningThis component will only appear if the screen's width < 768px. This happens because if the screen is phone width ( < 768px ), it will automatically adjust the layout to a list view making this component obselete. Refer to useIsPhone for more details.
-
Sort Select
This select component will set the value of
sortAtom
using enum ProjectSort./src/constants/project.tsenum ProjectSort {
Name = 'Name a-z'
DateCreated = 'Date Created'
LastModified = 'Last Modified'
}
Project View ( Grid View / List View )
This component contains a layout wrapper and an item component.
Both wrapper and item component are based on the value of viewType
: Grid or List.
<View
items={array}
itemComponent={Component}
componentProps={{
props1: value1
props2: value2
}}
/>
Parameter:
items: array of data(query)
itemComponent: the component that will contain each item
componentprops: props to be passed down to itemComponent
View Type
-
Grid
Wrapper: GridView
Item Component: ProjectGridItem
-
List
Wrapper: ListView
Item Component: ProjectListItem
- For phone width, List View is the only one available. Refer to useIsPhone for more details.
- When in loading query state, it will display ProjectSkeleton based on
viewType
.
Hooks
The hooks that are used in the component are the following:
-
use case: return an array of project queries and isLoading state
-
use case: return false if screen < 768px, otherwise true
-
use case: return a function to open an add/edit project modal