-
Notifications
You must be signed in to change notification settings - Fork 1
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 #1383 from trilitech/fix-beacon-signing
Fix beacon signing
- Loading branch information
Showing
12 changed files
with
572 additions
and
366 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { type PropsWithChildren, createContext, useContext } from "react"; | ||
|
||
const ModalContext = createContext<{ onClose: () => void }>({ onClose: () => {} }); | ||
|
||
export const MockModal = ({ | ||
children, | ||
isOpen, | ||
onClose, | ||
}: PropsWithChildren<{ isOpen: boolean; onClose: () => void }>) => ( | ||
<ModalContext.Provider value={{ onClose }}> | ||
<div data-testid="mock-modal">{isOpen ? children : null}</div> | ||
</ModalContext.Provider> | ||
); | ||
|
||
export const MockModalHeader = ({ children }: PropsWithChildren<object>) => ( | ||
<div id="modal-header">{children}</div> | ||
); | ||
|
||
export const MockModalContent = ({ children }: PropsWithChildren<object>) => ( | ||
<section aria-labelledby="modal-header" aria-modal role="dialog"> | ||
{children} | ||
</section> | ||
); | ||
|
||
export const MockModalInnerComponent = ({ children }: PropsWithChildren<object>) => ( | ||
<div>{children}</div> | ||
); | ||
|
||
export const MockModalCloseButton = ({ children }: PropsWithChildren<object>) => { | ||
const { onClose } = useContext(ModalContext); | ||
|
||
return ( | ||
<button aria-label="Close" onClick={onClose} type="button"> | ||
{children} | ||
</button> | ||
); | ||
}; |
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
Oops, something went wrong.