@im-swim/swim-book-form
v0.2.0
Published
Test Package to check React Component Library
Downloads
2
Readme
SWIM Book Form
A library exporting SWIM Booking Form as a React Component. This is a Test Package to check React Component Library.
Installation
npm install @im-swim/swim-book-form
Build is inspired from this article
Test Code
App.js
import React, { useState } from "react";
import "./App.scss";
import Form from "@im-swim/swim-book-form";
function App() {
const [name, setName] = useState("");
const [showForm, setShowForm] = useState(false);
return (
<div>
<div className="App">Test Popup Form</div>
<br />
<div>
<label htmlFor="">Initial Name: </label>
<input
type="text"
onChange={(e) => {
setName(e.target.value);
}}
/>
</div>
<button
onClick={() => {
setShowForm(true);
}}
>
Open Popup
</button>
{showForm && (
<Form
onClose={(data) => {
setShowForm(false);
setName(data?.name);
console.log(data);
}}
initialName={name}
/>
)}
<div>
<span>Final Name: </span>
<span>{name}</span>
</div>
</div>
);
}
export default App;