-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Global button for opening Implementer Tools (#482)
* Added global implementer tools button * Shifted the global implementer tools button to the bottom
- Loading branch information
1 parent
85c8423
commit 6836764
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
packages/apps/esm-implementer-tools-app/src/global-implementer-tools-button.test.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,13 @@ | ||
import { cleanup, render, screen } from "@testing-library/react"; | ||
import React from "react"; | ||
import "@testing-library/jest-dom"; | ||
import GlobalImplementerToolsButton from "./global-implementer-tools.component"; | ||
|
||
describe("Testing the global implementer tools button", () => { | ||
afterEach(cleanup); | ||
it("should render global Implementer tools", () => { | ||
render(<GlobalImplementerToolsButton />); | ||
const button = screen.getByTestId("globalImplementerToolsButton"); | ||
expect(button).toBeInTheDocument(); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
packages/apps/esm-implementer-tools-app/src/global-implementer-tools.component.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,27 @@ | ||
import React from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import ChevronUp from "@carbon/icons-react/es/chevron--up/16"; | ||
import ChevronDown from "@carbon/icons-react/es/chevron--down/16"; | ||
import { UserHasAccess, useStore } from "@openmrs/esm-framework"; | ||
import { implementerToolsStore, togglePopup } from "./store"; | ||
import styles from "./implementer-tools.styles.scss"; | ||
|
||
const GlobalImplementerToolsButton: React.FC = () => { | ||
const { t } = useTranslation(); | ||
const { isOpen } = useStore(implementerToolsStore); | ||
|
||
return ( | ||
<UserHasAccess privilege="coreapps.systemAdministration"> | ||
<div | ||
className={styles.chevronImplementerToolsButton} | ||
data-testid="globalImplementerToolsButton" | ||
> | ||
<div onClick={togglePopup} role="button" tabIndex={0}> | ||
{isOpen ? <ChevronDown /> : <ChevronUp />} | ||
</div> | ||
</div> | ||
</UserHasAccess> | ||
); | ||
}; | ||
|
||
export default GlobalImplementerToolsButton; |
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