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

[58256] header and sidebar menu should be hidden while pressing zen mode button #195

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/three-cooks-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openproject/primer-view-components": patch
---

[58256] Add a click event listener for the button so we can listen to this event and make whatever changes that we want
12 changes: 12 additions & 0 deletions app/components/primer/open_project/zen_mode_button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ class ZenModeButtonElement extends HTMLElement {
@target button: HTMLElement
inZenMode = false

dispatchZenModeStatus() {
// Create a new custom event
const event = new CustomEvent('zenModeToggled', {
detail: {
active: this.inZenMode,
},
})
// Dispatch the custom event
window.dispatchEvent(event)
}

private deactivateZenMode() {
this.inZenMode = false
this.button.setAttribute('aria-pressed', 'false')
Expand All @@ -27,6 +38,7 @@ class ZenModeButtonElement extends HTMLElement {
} else {
this.activateZenMode()
}
this.dispatchZenModeStatus()
}
}

Expand Down
Loading