0.2.0 • Published 2 years ago

@im-swim/swim-book-form v0.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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;
0.2.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago