0.0.17 • Published 11 months ago
@k90891695/modalnpm v0.0.17
@k90891695/modalnpm
A library of React components created using create-react-app
.
Versions
- Node v18.16.0
- React v18
Installation
Run the following command:
npm i @k90891695/modalnpm
Import
import { Modal } from '@k90891695/modalnpm'
Parameters
- setIsOpen: Prop function
- color: Prop string
- title: Prop string
- commentary: Prop string
- action: Prop string
Example
Here is a simple example of @k90891695/npmmodal being used in a page "Modal" with a button "Open":
import React, { useState } from 'react'
import { Modal } from '@k90891695/modalnpm'
const App = () => {
// Function to open the modal
const openModal = () => {
setIsOpen(true)
}
// Open or closed state of the modal
const [isOpen, setIsOpen] = useState(false);
// Style for classname 'title'
const divStyle = {
color: 'blue',
textAlign: "center"
}
// Style for the open button of the modal
const buttonStyle = {
color: 'red',
display: 'flex',
marginLeft: 'auto',
marginRight: 'auto'
}
return (
<div>
<div style={divStyle} className="title">
<h1>Modal</h1>
</div>
<div className="container">
<button style={buttonStyle} onClick ={openModal}>Open</button>
{isOpen && <Modal setIsOpen={setIsOpen} color={'#d0fefd'} title={'Information'} commentary={'Modal is open !'} action={'Close'} />}
</div>
</div>
)
}
export default App
0.0.17
11 months ago
0.0.16
11 months ago
0.0.15
11 months ago
0.0.14
11 months ago
0.0.13
11 months ago
0.0.12
11 months ago
0.0.11
11 months ago
0.0.10
11 months ago
0.0.9
11 months ago
0.0.8
11 months ago
0.0.7
11 months ago
0.0.6
11 months ago
0.0.5
11 months ago
0.0.4
11 months ago
0.0.3
11 months ago
0.0.2
11 months ago
0.0.1
11 months ago
0.0.0
11 months ago