
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@impactdk/react-modal
Advanced tools
A simple modal implementation for react. Also features a component for easily spawning react portals if you need to inject something else than a modal outside of the scope of the app.
A simple modal implementation for react. Also features a component for easily spawning react portals if you need to inject something else than a modal outside of the scope of the app.
npm install --save @impactdk/react-modal
While it is possible to use the included Modal component out of the box, it's advised to make a custom modal component through the factory method (next section).
import React, { useRef } from 'react';
import { IModalRef, Modal } from '@impactdk/react-modal';
export const App = () => {
const modalRef = useRef<IModalRef>();
function openModal(): void {
modalRef.current.open();
}
return (
<div className="app">
<button onClick={openModal}>Open modal</button>
<Modal ref={modalRef}>
This is the Modal content!
</Modal>
</div>
);
};
To use the default (scss) styling, import the file into another scss file. To alter the default styling, either work with the overridable scss variables, or override the styling done to the selectors completely.
// Default values for each variable are shown below.
$react-modal-z-index: 10000;
$react-modal-content-padding: 50px;
$react-modal-content-max-width: 600px;
$react-modal-class: modal;
@import "node_modules/react-modal/styles";
@import "node_modules/react-modal/styles";
.modal {
// Override styling here...
}
It's possible to make a custom modal component through the included factory function, allowing you to set relevant default properties so you don't have to every time you use the component.
// custom-modal.ts
import { modalFactory, IModalProps } from '@impactdk/react-modal';
import { MyCustomCloseButton } from "./buttons/my-custom-close-button";
const defaultProps: IModalProps = {
...
};
export const CustomModal = modalFactory("custom-modal", MyCustomCloseButton, "backdrop-animation", defaultProps);
And then use it as you would with the included Modal component:
import React, { useRef } from 'react';
import { IModalRef } from '@impactdk/react-modal';
import { CustomModal } from "./custom-modal";
export const App = () => {
const modalRef = useRef<IModalRef>();
function openModal(): void {
modalRef.current.open();
}
return (
<div className="app">
<button onClick={openModal}>Open modal</button>
<CustomModal ref={modalRef}>
This is the Modal content!
</CustomModal>
</div>
);
};
FAQs
A simple modal implementation for react. Also features a component for easily spawning react portals if you need to inject something else than a modal outside of the scope of the app.
We found that @impactdk/react-modal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.