ryan-modal
v1.1.1
Published
package containing reusable modal component by ryan π¦
Downloads
12
Readme
ryan-modal
κ°λ¨ν μ€λͺ
ryan-modal
μ μΌλ°μ μΌλ‘ μ¬μ¬μ© κ°λ₯ν λͺ¨λ¬ μ»΄ν¬λνΈμ
λλ€. ν©μ± μ»΄ν¬λνΈ ννλ‘, 컀μ€ν°λ§μ΄μ§ν μ μλ λ€μν μ΅μ
μ μ 곡νμ¬ μ¬μ© λ§₯λ½μ λ§κ² λͺ¨λ¬μ μ½κ² ꡬμ±ν μ μμ΅λλ€.
μ€μΉ λ°©λ²
npm install ryan-modal
μ¬μ© μμ
import { Modal } from "ryan-modal";
// λͺ¨λ¬ μ¬μ© μμ
const App = () => {
return (
<Modal isOpen={isOpen} onClose={onClose}>
<Modal.Dimmer />
<Modal.Content position={position} size={contentSize}>
<header>
<h2>{title}</h2>
</header>
<main style={{ margin: "16px 0" }}>{contentText}</main>
<footer style={{ display: "flex", flexDirection: "row-reverse" }}>
<Modal.Button theme={confirmButtonTheme} size={buttonSize} onClick={onModalButtonClick}>
{confirmButtonText}
</Modal.Button>
</footer>
</Modal.Content>
</Modal>
);
};
API λͺ μΈ
Modal
μ»΄ν¬λνΈ κ΅¬μ±
Modal
μ»΄ν¬λνΈλ λ€μκ³Ό κ°μ΄ ꡬμ±λ©λλ€.
Modal
: λͺ¨λ¬μ λ°νμ μ΄λ£¨λ λ£¨νΈ μ»΄ν¬λνΈμ λλ€.Modal.Dimmer
: λ°°κ²½ λ·λ°°κ²½μ λνλ΄λ μ»΄ν¬λνΈμ λλ€.Modal.Content
: λͺ¨λ¬ λ΄μ©μ λ΄λ μ»΄ν¬λνΈμ λλ€.Modal.CloseButton
: λͺ¨λ¬μ λ«λ λ«κΈ° λ²νΌμ ν΄λΉνλ μ»΄ν¬λνΈμ λλ€.Modal.Button
: λͺ¨λ¬ λ΄μμ μ¬μ©λλ λ²νΌμ ν΄λΉνλ μ»΄ν¬λνΈμ λλ€.Modal.Input
: λͺ¨λ¬ λ΄μμ μ¬μ©λλ ν둬ννΈ μ λ ₯ νλμ ν΄λΉνλ μ»΄ν¬λνΈμ λλ€.
Modal
μΈν°νμ΄μ€
export interface ModalMainProps extends React.HTMLAttributes<HTMLDivElement> {
onClose: () => void;
isOpen: boolean;
}
export interface ModalDimmerProps extends React.HTMLAttributes<HTMLDivElement> {}
export interface ModalCloseButtonProps extends React.HTMLAttributes<HTMLOrSVGElement> {
length?: string;
}
export interface ModalButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
theme?: "dark" | "light";
size?: "small" | "medium" | "large";
fullWidth?: boolean;
disabled?: boolean;
}
export interface ModalContentProps extends React.HTMLAttributes<HTMLDivElement> {
position?: "center" | "bottom";
size?: "small" | "medium" | "large";
}
export interface ModalInputProps extends React.HTMLAttributes<HTMLInputElement> {
value: string;
placeholder: string;
}
κ°λ° λ° κΈ°μ¬
μ΄ ν¨ν€μ§λ GitHub μ μ₯μμμ κ΄λ¦¬λκ³ μμ΅λλ€. κΈ°μ¬λ₯Ό νμν©λλ€!
λΌμ΄μΌμ€
μ΄ ν¨ν€μ§λ MIT λΌμ΄μΌμ€ νμ λ°°ν¬λ©λλ€.