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

v0.2.8 #37

Merged
merged 4 commits into from
Dec 25, 2023
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
4 changes: 2 additions & 2 deletions addon/components/layout/header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<LinkToExternal @route="console" class="logo navbar-logo mr-4">
<LogoIcon @brand={{@brand}} @size="8" />
</LinkToExternal>
{{#if @sidebarToggleEnabled}}
<Layout::Header::SidebarToggle class="mr-2" />
{{#if @showSidebarToggle}}
<Layout::Header::SidebarToggle class="mr-2" @onToggle={{@onSidebarToggle}} @disabled={{not @sidebarToggleEnabled}} />
{{/if}}
{{#unless (media "isMobile")}}
<div role="menu" class="next-catalog-menu-items flex mr-4">
Expand Down
2 changes: 1 addition & 1 deletion addon/components/layout/header/sidebar-toggle.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="sidebar-toggle-button-wrapper flex-shrink-0 {{if this.isSidebarVisible "sidebar-is-visible"}}" ...attributes>
<div class="sidebar-toggle-button-wrapper flex-shrink-0 {{if @disabled "disabled opacity-50"}} {{if this.isSidebarVisible "sidebar-is-visible"}}" ...attributes>
<button type="button" {{on 'click' this.toggleSidebar}} class="sidebar-toggle-button next-org-button-trigger">
<svg id="sidebar-toggle-icon" data-name="sidebar-toggle-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 392 340">
<rect x="0" y="0" width="150" height="340" fill={{if this.isSidebarVisible "white" "transparent"}} rx="40" ry="40"></rect>
Expand Down
8 changes: 8 additions & 0 deletions addon/components/layout/header/sidebar-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export default class LayoutHeaderSidebarToggleComponent extends Component {
@tracked isSidebarVisible = true;

@action toggleSidebar() {
if (this.args.disabled === true) {
return;
}

const sidebar = this.universe.sidebarContext;

if (this.isSidebarVisible) {
Expand All @@ -17,5 +21,9 @@ export default class LayoutHeaderSidebarToggleComponent extends Component {
}

this.isSidebarVisible = !this.isSidebarVisible;

if (typeof this.args.onToggle === 'function') {
this.args.onToggle(sidebar, this.isSidebarVisible);
}
}
}
7 changes: 7 additions & 0 deletions addon/styles/components/sidebar-toggle.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
flex-shrink: 0;
}

.sidebar-toggle-button-wrapper.disabled:hover,
.sidebar-toggle-button-wrapper.disabled > button:hover {
background-color: transparent;
box-shadow: none;
border: none;
}

.sidebar-toggle-button-wrapper > .sidebar-toggle-button.next-org-button-trigger,
.sidebar-toggle-button-wrapper > .sidebar-toggle-button {
display: flex;
Expand Down
Loading