-
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 #2303 from fahad-aot/feature/FWF-3667-custom-header
feature/FWF:3728 -Added Dmn list page
- Loading branch information
Showing
13 changed files
with
368 additions
and
417 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
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
115 changes: 0 additions & 115 deletions
115
forms-flow-web/src/components/CustomComponents/Button.js
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
forms-flow-web/src/components/CustomComponents/SortableHeader.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,50 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
const SortableHeader = ({ columnKey, title, currentSort, handleSort,className = "" }) => { | ||
const { t } = useTranslation(); | ||
const sortedOrder = currentSort[columnKey]?.sortOrder; | ||
const isSorted = currentSort[columnKey] !== undefined; | ||
const handleKeyDown = (event)=>{ | ||
if (event.key === 'Enter') { | ||
handleSort(columnKey); | ||
} | ||
}; | ||
return ( | ||
<button | ||
className={`button-as-div ${className}`} | ||
onClick={() => handleSort(columnKey)} | ||
onKeyDown={handleKeyDown} | ||
aria-pressed={isSorted} | ||
data-testid = {`${title}-header-btn`} | ||
aria-label={`${title}-header-btn`} | ||
> | ||
<span className="mt-1">{t(title)}</span> | ||
<span> | ||
<i | ||
data-testid={`${columnKey}-${sortedOrder}-sort-icon`} | ||
className={`fa fa-arrow-${sortedOrder === "asc" ? "up" : "down"} sort-icon fs-16 ms-2`} | ||
data-toggle="tooltip" | ||
title={t(sortedOrder === "asc" ? "Ascending" : "Descending")} | ||
></i> | ||
</span> | ||
</button> | ||
); | ||
}; | ||
SortableHeader.propTypes = { | ||
columnKey: PropTypes.string.isRequired, | ||
title: PropTypes.string.isRequired, | ||
currentSort: PropTypes.shape({ | ||
activeKey: PropTypes.string.isRequired, | ||
sortOrder: PropTypes.oneOf(['asc', 'desc']).isRequired, | ||
}).isRequired, | ||
handleSort: PropTypes.func.isRequired, | ||
className: PropTypes.string, | ||
}; | ||
|
||
SortableHeader.defaultProps = { | ||
className: '', | ||
}; | ||
|
||
export default SortableHeader ; |
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
Oops, something went wrong.