-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2541 from abilpraju-aot/bugfix/4225
Add Refresh and Sort options to all designer listing page
- Loading branch information
Showing
8 changed files
with
396 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
forms-flow-web/src/components/CustomComponents/FilterSortActions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React from "react"; | ||
import { FilterIcon, RefreshIcon, SortModal } from "@formsflow/components"; | ||
import PropTypes from "prop-types"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
const FilterSortActions = ({ | ||
showSortModal, | ||
handleFilterIconClick, | ||
handleRefresh, | ||
handleSortModalClose, | ||
handleSortApply, | ||
defaultSortOption, | ||
defaultSortOrder, | ||
optionSortBy, // Accept optionSortBy as a prop | ||
}) => { | ||
const { t } = useTranslation(); | ||
return ( | ||
<> | ||
<FilterIcon onClick={handleFilterIconClick} /> | ||
<RefreshIcon onClick={handleRefresh} /> | ||
{showSortModal && ( | ||
<SortModal | ||
firstItemLabel={t("Sort By")} | ||
secondItemLabel={t("In a")} | ||
showSortModal={showSortModal} | ||
onClose={handleSortModalClose} | ||
primaryBtnAction={handleSortApply} | ||
modalHeader={t("Sort")} | ||
primaryBtnLabel={t("Sort Results")} | ||
secondaryBtnLabel={t("Cancel")} | ||
optionSortBy={optionSortBy} | ||
optionSortOrder={[ | ||
{ value: "asc", label: t("Ascending") }, | ||
{ value: "desc", label: t("Descending") }, | ||
]} | ||
defaultSortOption={defaultSortOption} | ||
defaultSortOrder={defaultSortOrder} | ||
/> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
// Add propTypes to validate props | ||
FilterSortActions.propTypes = { | ||
showSortModal: PropTypes.bool.isRequired, | ||
handleFilterIconClick: PropTypes.func.isRequired, | ||
handleRefresh: PropTypes.func.isRequired, | ||
handleSortModalClose: PropTypes.func.isRequired, | ||
handleSortApply: PropTypes.func.isRequired, | ||
defaultSortOption: PropTypes.string.isRequired, | ||
defaultSortOrder: PropTypes.string.isRequired, | ||
optionSortBy: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
value: PropTypes.string.isRequired, | ||
label: PropTypes.string.isRequired, | ||
}) | ||
).isRequired, | ||
}; | ||
|
||
export default FilterSortActions; |
Oops, something went wrong.