Merge pull request #399 from alishaz-polymath/main

Entering Title autogenerates Slug CAL-201
pull/400/head^2
Peer_Rich 2021-08-02 10:05:44 +02:00 committed by GitHub
commit a5ea3c2c32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -31,6 +31,12 @@ export default function Availability(props) {
return <div className="loader"></div>; return <div className="loader"></div>;
} }
function autoPopulateSlug() {
let t = titleRef.current.value;
t = t.replace(/\s+/g, '-').toLowerCase();
slugRef.current.value = t;
}
function toggleAddModal() { function toggleAddModal() {
setShowAddModal(!showAddModal); setShowAddModal(!showAddModal);
} }
@ -237,7 +243,7 @@ export default function Availability(props) {
<div className="mb-4"> <div className="mb-4">
<label htmlFor="title" className="block text-sm font-medium text-gray-700">Title</label> <label htmlFor="title" className="block text-sm font-medium text-gray-700">Title</label>
<div className="mt-1"> <div className="mt-1">
<input ref={titleRef} type="text" name="title" id="title" required className="shadow-sm focus:ring-blue-500 focus:border-blue-500 block w-full sm:text-sm border-gray-300 rounded-md" placeholder="Quick Chat" /> <input onChange={autoPopulateSlug} ref={titleRef} type="text" name="title" id="title" required className="shadow-sm focus:ring-blue-500 focus:border-blue-500 block w-full sm:text-sm border-gray-300 rounded-md" placeholder="Quick Chat" />
</div> </div>
</div> </div>
<div className="mb-4"> <div className="mb-4">