Skip to content

Commit

Permalink
#6298 Top bar styles (#6299)
Browse files Browse the repository at this point in the history
Fixes #6298
  • Loading branch information
novikov82 authored Dec 23, 2024
1 parent b81c55f commit 24537b3
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ export class TabDesignerPlugin implements ICreatorPlugin {
}
},
active: this.isSettingsActive,
pressed: this.isSettingsActive,
visible: this.createVisibleUpdater(),
locTitleName: "ed.surveySettings",
locTooltipName: "ed.surveySettingsTooltip",
Expand Down Expand Up @@ -411,11 +410,9 @@ export class TabDesignerPlugin implements ICreatorPlugin {
items.push(this.surveySettingsAction);
this.creator.onSelectedElementChanged.add((sender, options) => {
this.surveySettingsAction.active = this.isSettingsActive;
this.surveySettingsAction.pressed = this.isSettingsActive;
});
this.creator.onShowSidebarVisibilityChanged.add((sender, options) => {
this.surveySettingsAction.active = this.isSettingsActive;
this.surveySettingsAction.pressed = this.isSettingsActive;
});
return items;
}
Expand Down
60 changes: 31 additions & 29 deletions packages/survey-creator-core/src/utils/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,37 @@
color: var(--ctr-menu-toolbar-button-text-color, $foreground);
transition: background-color $creator-transition-duration;
height: auto;

//hovered and focused state
&:hover,
&:focus {
background-color: var(--ctr-menu-toolbar-button-background-color-hovered, $background-dim);
}

//pressed state
&:active,
&.sv-action-bar-item--pressed {
opacity: var(--ctr-menu-toolbar-button-opacity-pressed, 0.5);
background-color: var(--ctr-menu-toolbar-button-background-color-pressed, $background-dim);
use {
fill: black;
opacity: 0.45;
}
}

//checked state
&.sv-action-bar-item--active {
background-color: var(--ctr-menu-toolbar-button-background-color-selected, $background);
use {
fill: var(--ctr-menu-toolbar-button-text-color-selected, $primary);
}
}

//disabled state
&:disabled {
background-color: transparent;
opacity: var(--ctr-menu-toolbar-button-opacity-disabled, 0.25);
}
}

.sv-action-bar-item--icon {
Expand All @@ -141,39 +172,10 @@
}
}

//hovered state
.sv-action-bar-item:not(.sv-action-bar-item--pressed):hover:enabled,
.sv-action-bar-item:not(.sv-action-bar-item--pressed):focus:enabled {
background-color: var(--ctr-menu-toolbar-button-background-color-hovered, $background-dim);
}

//pressed state
.sv-action-bar-item:not(.sv-action-bar-item--pressed):active:enabled {
opacity: var(--ctr-menu-toolbar-button-opacity-pressed, 0.5);
background-color: var(--ctr-menu-toolbar-button-background-color-pressed, $background-dim);
}

//disabled state
.sv-action-bar-item:disabled {
opacity: var(--ctr-menu-toolbar-button-opacity-disabled, 0.25);
}


.sv-action-bar-item--active {
.sv-action-bar-item__icon use {
fill: var(--ctr-menu-toolbar-button-text-color-selected, $primary);
}
}

.sv-action-bar-item-dropdown {
border-radius: calcCornerRadius(0.5);
background-color: transparent;
}

.sv-action-bar-item--pressed:not(.sv-action-bar-item--active) {
background-color: var(--ctr-menu-toolbar-button-background-color-pressed, $background-dim);
opacity: var(--ctr-menu-toolbar-button-opacity-pressed, 50%);
}
}

.svc-footer-bar {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions visualRegressionTests/tests/designer/top-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ test("Top menu on designer tab", async (t) => {
.click(Selector("#action-undo .sv-action-bar-item"))
.click(Selector(".svc-side-bar .spg-row").nth(1));
await takeElementScreenshot("top-menu-redo-active.png", topBarElement, t, comparer);

await t
.hover(Selector("[title='Survey settings']"));
await takeElementScreenshot("top-menu-settings-checked-hovered.png", topBarElement, t, comparer);

await ClientFunction(() => {
window["creator"].toolbar.actions.map(a => a.pressed = true);
})();
await takeElementScreenshot("top-menu-pressed-buttons.png", topBarElement, t, comparer);
});
});
test("Top menu with single item", async (t) => {
Expand Down

0 comments on commit 24537b3

Please sign in to comment.