created navSubmitClick

main
anela 3 years ago
parent 0ad07d199c
commit 2a330ba28d

@ -38,7 +38,7 @@
<a class="nav-link" href="#" id="nav-all">Hack or Snooze</a> <a class="nav-link" href="#" id="nav-all">Hack or Snooze</a>
</div> </div>
<div class="nav-center"> <div class="nav-center">
<a class="nav-lin" href="#" id="">add story</a> <a class="nav-link" href="#" id="nav-submit">submit</a>
</div> </div>
<div class="nav-right"> <div class="nav-right">
<a class="nav-link" href="#" id="nav-login">login/signup</a> <a class="nav-link" href="#" id="nav-login">login/signup</a>
@ -63,12 +63,13 @@
<form id="add-story-form" class="add-story hidden"> <form id="add-story-form" class="add-story hidden">
<h4>Add a story</h4> <h4>Add a story</h4>
<label for="add-title">Title: </label> <label for="story-title">Title: </label>
<input id="add-title" type="text"> <input id="story-title" type="text">
<label for="add-author">Author: </label> <label for="story-author">Author: </label>
<input id="add-author" type="text"> <input id="story-author" type="text">
<label for="add-url">URL: </label> <label for="story-url">URL: </label>
<input id="add-url" type="text"> <input id="story-url" type="text">
<button type="submit">submit story</button>
</form> </form>
<!-- Login form --> <!-- Login form -->

@ -14,6 +14,8 @@ const $navLogin = $("#nav-login");
const $navUserProfile = $("#nav-user-profile"); const $navUserProfile = $("#nav-user-profile");
const $navLogOut = $("#nav-logout"); const $navLogOut = $("#nav-logout");
const $addStoryForm = $('#add-story-form');
/** To make it easier for individual components to show just themselves, this /** To make it easier for individual components to show just themselves, this
* is a useful function that hides pretty much everything on the page. After * is a useful function that hides pretty much everything on the page. After
* calling this, individual components can re-show just what they want. * calling this, individual components can re-show just what they want.

@ -36,3 +36,11 @@ function updateNavOnLogin() {
$navLogOut.show(); $navLogOut.show();
$navUserProfile.text(`${currentUser.username}`).show(); $navUserProfile.text(`${currentUser.username}`).show();
} }
/** Show story submission form on click on "submit" */
function navSubmitClick(evt) {
console.debug("navSubmitClick", evt);
evt.preventDefault();
hidePageComponents();
$addStoryForm.show();
}
Loading…
Cancel
Save