* Displays the given section element and changes styling of the given button.
( sectionElement?: HTMLElement, buttonElement?: HTMLElement, )
| 589 | * Displays the given section element and changes styling of the given button. |
| 590 | */ |
| 591 | function showSection( |
| 592 | sectionElement?: HTMLElement, |
| 593 | buttonElement?: HTMLElement, |
| 594 | ) { |
| 595 | recentPostsSection.style.display = 'none'; |
| 596 | userPostsSection.style.display = 'none'; |
| 597 | topUserPostsSection.style.display = 'none'; |
| 598 | addPost.style.display = 'none'; |
| 599 | recentMenuButton.classList.remove('is-active'); |
| 600 | myPostsMenuButton.classList.remove('is-active'); |
| 601 | myTopPostsMenuButton.classList.remove('is-active'); |
| 602 | |
| 603 | if (sectionElement) { |
| 604 | sectionElement.style.display = 'block'; |
| 605 | } |
| 606 | if (buttonElement) { |
| 607 | buttonElement.classList.add('is-active'); |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | // Bind Sign in button. |
| 612 | signInButton.addEventListener('click', function () { |