Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the new navigation concept for Newshub #808

Merged
merged 5 commits into from
Mar 15, 2024

Conversation

dzonidoo
Copy link
Contributor

NHUB-485

Checklist

  • This pull request is not adding new forms that use redux
  • This pull request is adding missing TypeScript types to modified code segments where it's easy to do so with confidence
  • This pull request is replacing lodash.get with optional chaining for modified code segments

@petrjasek petrjasek added this to the v2.7 milestone Feb 28, 2024
newsroom/templates/base_layout.html Outdated Show resolved Hide resolved
newsroom/templates/base_layout.html Outdated Show resolved Hide resolved
@dzonidoo dzonidoo requested a review from petrjasek March 11, 2024 11:55
assets/index.ts Outdated
const pinButton = document.getElementById('pin-btn');

if (pinButton != null) {
pinButton.onclick = handleNavExpanded;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use pinButton.addEventListener it's a more idiomatic way to do this.

assets/index.ts Outdated
handleNavExpanded();
}

function handleNavExpanded() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming implies the function only runs on expansion, when in fact it also runs on collapsing. The name would be needed to be updated accordingly, but since that function is only used once - it doesn't make sesne to have it at all. Simply inline it in the event listener callback.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this function is not used only once...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right - I missed the second usage. Then only improve the name.

assets/index.ts Outdated
}

function handleNavExpanded() {
if (element?.classList.contains('nav-block--pinned')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve readability by returning early if element is null and doing the logic afterwards

@dzonidoo dzonidoo requested a review from tomaskikutis March 13, 2024 15:41
@petrjasek petrjasek merged commit 3c07ab3 into superdesk:new-components Mar 15, 2024
6 of 7 checks passed
petrjasek pushed a commit to petrjasek/newsroom-core that referenced this pull request Aug 21, 2024
* add navigation

* changes after review

* fix lint

* chages after review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants