-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in r2-3086-mobile-sort-disabled (pull request #6974)
R2-3086 - Disable sort for mobile when a phonetic search is performed Approved-by: Joshua Toliver
- Loading branch information
Showing
3 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
app/javascript/components/record-list/components/sort-container/sort-button.jsx
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,34 @@ | ||
// Copyright (c) 2014 - 2023 UNICEF. All rights reserved. | ||
|
||
import { Fragment } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { IconButton, Tooltip } from "@mui/material"; | ||
import ImportExportIcon from "@mui/icons-material/ImportExport"; | ||
|
||
import { useI18n } from "../../../i18n"; | ||
|
||
function Component({ phonetic = false, toggleSortDrawer }) { | ||
const i18n = useI18n(); | ||
|
||
const Wrapper = phonetic ? Tooltip : Fragment; | ||
const props = phonetic ? { title: i18n.t("messages.record_list.sort_disabled_name_fields") } : {}; | ||
|
||
return ( | ||
<Wrapper {...props}> | ||
<span> | ||
<IconButton size="large" onClick={toggleSortDrawer} color="primary" disabled={phonetic}> | ||
<ImportExportIcon /> | ||
</IconButton> | ||
</span> | ||
</Wrapper> | ||
); | ||
} | ||
|
||
Component.displayName = "SortButton"; | ||
|
||
Component.propTypes = { | ||
phonetic: PropTypes.bool, | ||
toggleSortDrawer: PropTypes.func.isRequired | ||
}; | ||
|
||
export default Component; |
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