-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvements to customize query page - pt 1 (#2642)
* fractionize selection state * button selection state toggle * have the links smart toggle * [pre-commit.ci] auto fixes from pre-commit hooks * lint --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c0e7dd7
commit 2aef6d0
Showing
5 changed files
with
89 additions
and
29 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
52 changes: 52 additions & 0 deletions
52
containers/tefca-viewer/src/app/query/components/customizeQuery/CustomizeQueryBulkSelect.tsx
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,52 @@ | ||
import styles from "../customizeQuery/customizeQuery.module.css"; | ||
|
||
type CustomizeQueryBulkSelectProps = { | ||
allItemsDeselected: boolean; | ||
allItemsSelected: boolean; | ||
handleBulkSelectForTab: (checked: boolean) => void; | ||
activeTab: string; | ||
}; | ||
/** | ||
* | ||
* @param root0 - params | ||
* @param root0.allItemsDeselected - boolean used for the deselect toggle | ||
* @param root0.allItemsSelected - boolean used for the select toggle | ||
* @param root0.handleBulkSelectForTab - handler function for the link toggles | ||
* @param root0.activeTab - which tab is currently selected | ||
* @returns bulk select link selection | ||
*/ | ||
const CustomizeQueryBulkSelect: React.FC<CustomizeQueryBulkSelectProps> = ({ | ||
allItemsDeselected, | ||
allItemsSelected, | ||
handleBulkSelectForTab, | ||
activeTab, | ||
}) => { | ||
return ( | ||
<div className="display-flex"> | ||
{!allItemsSelected && ( | ||
<button | ||
className={`usa-button usa-button--unstyled ${styles.bulkSelectLink} `} | ||
onClick={(e) => { | ||
e.preventDefault(); | ||
handleBulkSelectForTab(true); | ||
}} | ||
> | ||
Select all {activeTab} | ||
</button> | ||
)} | ||
{!allItemsDeselected && ( | ||
<button | ||
className={`usa-button usa-button--unstyled ${styles.bulkSelectLink} `} | ||
onClick={(e) => { | ||
e.preventDefault(); | ||
handleBulkSelectForTab(false); | ||
}} | ||
> | ||
Deselect all {activeTab} | ||
</button> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default CustomizeQueryBulkSelect; |
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