[AAE-5660] Reduce SCSS mixins and use CSS variables instead (#2255)

* optimise create menu theme

* optimise details component

* optimise sidenav component

* optimise search input theme

* optimise template dialog theme
This commit is contained in:
Denys Vuika
2021-08-11 14:31:30 +01:00
committed by GitHub
parent cd2aa173b8
commit 016bc0ac81
11 changed files with 244 additions and 299 deletions

View File

@@ -1,93 +1,87 @@
@mixin app-create-menu-theme($theme) { .app-create-menu:focus {
$foreground: map-get($theme, foreground); outline: none;
$accent: map-get($theme, accent); }
$primary: map-get($theme, primary);
.app-create-menu:focus { .app-create-menu {
outline: none; width: 100%;
.mat-raised-button {
width: 100%;
display: block;
box-shadow: none !important;
height: 37.5px;
background-color: var(--theme-accent-color);
color: var(--theme-primary-color-default-contrast);
border-radius: 4px;
font-size: 12.7px;
font-weight: normal;
text-transform: uppercase;
.mat-icon {
width: 24px;
height: 25px;
color: var(--theme-primary-color-default-contrast);
}
&__text {
width: 100%;
height: 20px;
text-align: left;
}
} }
.app-create-menu { &__root-menu {
width: 100%; max-width: 290px !important;
width: 290px;
display: flex;
align-items: center;
justify-content: center;
.mat-raised-button { & > .mat-menu-content {
width: 100%; width: 100%;
display: block; }
box-shadow: none !important; }
height: 37.5px;
background-color: mat-color($accent); &--collapsed {
color: mat-color($primary, default-contrast) !important; outline: none;
border-radius: 4px; color: var(--theme-secondary-text-color);
font-size: 12.7px; cursor: pointer;
&:hover {
color: var(--theme-accent-color);
}
margin: 0;
border: none;
background: none;
}
.app-create-menu--icon {
color: var(--theme-accent-color);
}
&__sub-menu {
.mat-menu-item {
display: flex;
flex-direction: row;
align-items: center;
font-size: 14px;
color: var(--theme-secondary-text-color);
line-height: 48px;
box-shadow: none;
transform: none;
transition: unset;
font-weight: normal; font-weight: normal;
text-transform: uppercase;
&:hover {
color: var(--theme-primary-color);
}
}
.mat-menu-item[disabled],
.mat-menu-item[disabled]:hover {
color: var(--theme-text-disabled-color);
.mat-icon { .mat-icon {
width: 24px; color: var(--theme-text-disabled-color);
height: 25px;
color: mat-color($primary, default-contrast) !important;
}
&__text {
width: 100%;
height: 20px;
text-align: left;
}
}
&__root-menu {
max-width: 290px !important;
width: 290px;
display: flex;
align-items: center;
justify-content: center;
& > .mat-menu-content {
width: 100%;
}
}
&--collapsed {
outline: none;
color: mat-color($foreground, secondary-text);
cursor: pointer;
&:hover {
color: mat-color($accent);
}
margin: 0;
border: none;
background: none;
}
.app-create-menu--icon {
color: mat-color($accent);
}
&__sub-menu {
.mat-menu-item {
display: flex;
flex-direction: row;
align-items: center;
font-size: 14px;
color: mat-color($foreground, secondary-text);
line-height: 48px;
box-shadow: none;
transform: none;
transition: unset;
font-weight: normal;
&:hover {
color: mat-color($primary);
}
}
.mat-menu-item[disabled],
.mat-menu-item[disabled]:hover {
color: mat-color($foreground, text, 0.38);
.mat-icon {
color: mat-color($foreground, text, 0.38);
}
} }
} }
} }

View File

@@ -34,6 +34,7 @@ import { AppExtensionService } from '@alfresco/aca-shared';
@Component({ @Component({
selector: 'app-create-menu', selector: 'app-create-menu',
templateUrl: './create-menu.component.html', templateUrl: './create-menu.component.html',
styleUrls: ['./create-menu.component.scss'],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
host: { class: 'app-create-menu' } host: { class: 'app-create-menu' }
}) })

View File

@@ -1,45 +1,41 @@
@mixin app-details-theme($theme) { .acs-details-container {
$background: map-get($theme, background); background-color: var(--theme-card-background-color);
width: 100%;
.acs-details-container { }
background-color: mat-color($background, card);
width: 100%; .adw-details-tabs {
} margin-top: 40px;
height: calc(100% - 80px);
.adw-details-tabs {
margin-top: 40px; .mat-tab-body-wrapper {
height: calc(100% - 80px); height: 100%;
}
.mat-tab-body-wrapper {
height: 100%; .mat-tab-labels {
} text-transform: uppercase;
}
.mat-tab-labels { }
text-transform: uppercase;
} .acs-details-title {
} width: 100%;
display: flex;
.acs-details-title { align-items: center;
width: 100%; justify-content: space-between;
display: flex;
align-items: center; .acs-close-members-container {
justify-content: space-between; margin-right: 15px;
}
.acs-close-members-container { }
margin-right: 15px;
} .acs-details-breadcrumb {
} font-size: 18px;
margin-left: 20px;
.acs-details-breadcrumb {
font-size: 18px; .acs-details-breadcrumb-library {
margin-left: 20px; font-weight: 900;
}
.acs-details-breadcrumb-library {
font-weight: 900; .acs-details-breadcrumb-item {
} font-weight: 100;
}
.acs-details-breadcrumb-item {
font-weight: 100;
}
}
} }

View File

@@ -35,6 +35,7 @@ import { Subject } from 'rxjs';
@Component({ @Component({
selector: 'app-details-manager', selector: 'app-details-manager',
templateUrl: './details.component.html', templateUrl: './details.component.html',
styleUrls: ['./details.component.scss'],
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class DetailsComponent extends PageComponent implements OnInit, OnDestroy { export class DetailsComponent extends PageComponent implements OnInit, OnDestroy {

View File

@@ -4,43 +4,47 @@ $search-background: #f5f6f5;
$search-border-radius: 4px; $search-border-radius: 4px;
$top-margin: 12px; $top-margin: 12px;
@mixin aca-search-input-theme($theme) { .app-search-container {
$background: map-get($theme, background); color: var(--theme-foreground-text-color);
$foreground: map-get($theme, foreground);
$border: 1px solid mat-color($foreground, divider, 0.07);
.app-search-container { .app-input-form-field {
color: mat-color($foreground, text, 0.72); .mat-input-element {
caret-color: var(--theme-text-color);
.app-input-form-field { &:disabled {
.mat-input-element { color: var(--theme-text-color);
caret-color: mat-color($foreground, text, 0.54);
&:disabled {
color: mat-color($foreground, text, 0.54);
}
} }
} }
.mat-focused label.mat-form-field-label {
display: none;
}
} }
.app-search-options-menu { .mat-focused label.mat-form-field-label {
&.mat-menu-panel { display: none;
background-color: mat-color($background, dialog);
}
} }
#search-options { }
color: mat-color($foreground, text, 0.54);
border-top: $border; .app-search-options-menu {
&.mat-menu-panel {
background-color: var(--theme-dialog-background-color);
width: $search-width;
max-width: unset;
border-radius: $search-border-radius;
margin-top: $top-margin;
} }
mat-checkbox { .mat-menu-content:not(:empty) {
.mat-checkbox-frame { padding-top: 0;
border-color: mat-color($foreground, text, 0.54); padding-bottom: 0;
} }
}
#search-options {
color: var(--theme-text-color);
border-top: 1px solid var(--theme-divider-color);
}
mat-checkbox {
.mat-checkbox-frame {
border-color: var(--theme-text-color);
} }
} }
@@ -62,20 +66,6 @@ $top-margin: 12px;
margin-top: -$top-margin; margin-top: -$top-margin;
} }
.app-search-options-menu {
&.mat-menu-panel {
width: $search-width;
max-width: unset;
border-radius: $search-border-radius;
margin-top: $top-margin;
}
.mat-menu-content:not(:empty) {
padding-top: 0;
padding-bottom: 0;
}
}
#search-options { #search-options {
padding: 20px 0; padding: 20px 0;
font-size: 16px; font-size: 16px;
@@ -107,7 +97,7 @@ $top-margin: 12px;
padding-left: 17px; padding-left: 17px;
} }
@media screen and ($mat-small) { @media screen and (max-width: 959px) {
$search-width-small: 400px; $search-width-small: 400px;
.aca-search-input { .aca-search-input {
@@ -141,7 +131,7 @@ $top-margin: 12px;
} }
} }
@media screen and ($mat-xsmall) { @media screen and (max-width: 599px) {
$search-width-xsmall: 220px; $search-width-xsmall: 220px;
.aca-search-input { .aca-search-input {

View File

@@ -39,6 +39,7 @@ import { SearchLibrariesQueryBuilderService } from '../search-libraries-results/
@Component({ @Component({
selector: 'aca-search-input', selector: 'aca-search-input',
templateUrl: './search-input.component.html', templateUrl: './search-input.component.html',
styleUrls: ['./search-input.component.scss'],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
host: { class: 'aca-search-input' } host: { class: 'aca-search-input' }
}) })

View File

@@ -6,11 +6,26 @@
overflow-y: hidden; overflow-y: hidden;
} }
.aca-menu-panel {
.action-button--active {
color: var(--theme-accent-color) !important;
}
.action-button {
color: var(--theme-primary-color);
}
.action-button:hover {
color: var(--theme-accent-color);
}
}
.sidenav { .sidenav {
display: flex; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
background-color: var(--theme-background-color);
.section:last-child { .section:last-child {
border-bottom: 0; border-bottom: 0;
@@ -34,6 +49,7 @@
.section { .section {
padding: 8px 6px; padding: 8px 6px;
border-bottom: 1px solid var(--theme-divider-color);
} }
.section--collapsed { .section--collapsed {
@@ -60,6 +76,14 @@
width: 100%; width: 100%;
} }
.action-button--active {
color: var(--theme-primary-color) !important;
}
.action-button {
color: var(--theme-text-color);
}
.action-button .action-button__label { .action-button .action-button__label {
margin: 0 8px !important; margin: 0 8px !important;
} }
@@ -82,14 +106,25 @@
user-select: none; user-select: none;
} }
.item:hover .action-button__label {
color: var(--theme-primary-color);
}
.mat-expansion-panel-header { .mat-expansion-panel-header {
padding: 0 8px 0 0 !important; padding: 0 8px 0 0 !important;
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 14px !important;
} }
.mat-expansion-panel { .mat-expansion-panel {
width: 100%; width: 100%;
background-color: unset;
box-shadow: none !important;
}
.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled='true']):hover {
background: none !important;
} }
.mat-expansion-indicator { .mat-expansion-indicator {

View File

@@ -1,58 +0,0 @@
@mixin sidenav-component-theme($theme) {
$primary: map-get($theme, primary);
$accent: map-get($theme, accent);
$foreground: map-get($theme, foreground);
$background: map-get($theme, background);
$border: 1px solid mat-color($foreground, divider, 0.07);
.aca-menu-panel {
.action-button--active {
color: mat-color($accent) !important;
}
.action-button {
color: mat-color($primary);
}
.action-button:hover {
color: mat-color($accent);
}
}
.sidenav {
background-color: mat-color($background, background);
.item:hover .action-button__label {
color: mat-color($primary);
}
.mat-expansion-panel {
background-color: unset;
}
.mat-expansion-panel {
box-shadow: none !important;
}
.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled='true']):hover {
background: none !important;
}
.mat-expansion-panel-header {
font-size: 14px !important;
}
.action-button--active {
color: mat-color($primary) !important;
}
.action-button {
color: mat-color($foreground, text, 0.54);
}
.section {
border-bottom: $border;
}
}
}

View File

@@ -1,64 +1,57 @@
@mixin app-create-from-template-theme($theme) { .aca-create-from-template-dialog {
$primary: map-get($theme, primary); ng-component {
$accent: map-get($theme, accent); overflow: visible;
$foreground: map-get($theme, foreground); }
$background: map-get($theme, background);
.aca-create-from-template-dialog { .mat-dialog-title {
ng-component { margin-left: 24px;
overflow: visible; margin-right: 24px;
font-size: 20px;
font-style: normal;
font-stretch: normal;
line-height: 1.6;
letter-spacing: -0.5px;
color: var(--theme-text-bold-color);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.bold {
font-weight: 600;
}
}
.mat-form-field {
margin-bottom: 20px;
}
.mat-dialog-container {
padding-left: 0;
padding-right: 0;
}
.mat-dialog-content {
margin: 0 2px;
overflow: hidden;
}
.mat-dialog-actions {
padding: 8px 22px;
display: flex;
justify-content: flex-end;
color: var(--theme-secondary-text-color);
button {
text-transform: uppercase;
font-weight: normal;
} }
.mat-dialog-title { .create[disabled] {
margin-left: 24px; opacity: 0.6;
margin-right: 24px;
font-size: 20px;
font-style: normal;
font-stretch: normal;
line-height: 1.6;
letter-spacing: -0.5px;
color: mat-color($foreground, text, 0.87);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.bold {
font-weight: 600;
}
} }
.mat-form-field { .create:enabled {
margin-bottom: 20px; color: var(--theme-accent-color);
}
.mat-dialog-container {
padding-left: 0;
padding-right: 0;
}
.mat-dialog-content {
margin: 0 2px;
overflow: hidden;
}
.mat-dialog-actions {
padding: 8px 22px;
display: flex;
justify-content: flex-end;
color: mat-color($foreground, secondary-text);
button {
text-transform: uppercase;
font-weight: normal;
}
.create[disabled] {
opacity: 0.6;
}
.create:enabled {
color: mat-color($accent);
}
} }
} }
} }

View File

@@ -33,6 +33,7 @@ import { TranslationService } from '@alfresco/adf-core';
@Component({ @Component({
templateUrl: './create-from-template.dialog.html', templateUrl: './create-from-template.dialog.html',
styleUrls: ['./create-from-template.dialog.scss'],
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class CreateFromTemplateDialogComponent implements OnInit { export class CreateFromTemplateDialogComponent implements OnInit {

View File

@@ -1,14 +1,6 @@
@import '~@angular/material/theming'; @import '~@angular/material/theming';
@import '~@alfresco/adf-content-services/theming'; @import '~@alfresco/adf-content-services/theming';
@import '../components/sidenav/sidenav.component.theme';
@import '../components/search/search-input/search-input.component.theme';
@import '../components/create-menu/create-menu.component.scss';
@import '../dialogs/node-template/create-from-template.dialog.scss';
@import '../components/details/details.component.scss';
@import './overrides/adf-style-fixes.theme'; @import './overrides/adf-style-fixes.theme';
@import 'colors'; @import 'colors';
@include mat-core(); @include mat-core();
@@ -27,12 +19,6 @@ $primary: map-get($custom-theme, primary);
@include angular-material-theme($theme); @include angular-material-theme($theme);
@include adf-content-services-theme($theme); @include adf-content-services-theme($theme);
@include adf-core-theme($theme); @include adf-core-theme($theme);
@include aca-search-input-theme($theme);
@include sidenav-component-theme($theme);
@include app-create-from-template-theme($theme);
@include app-details-theme($theme);
@include app-create-menu-theme($theme);
@include adf-style-fixes($theme); @include adf-style-fixes($theme);
.mat-toolbar { .mat-toolbar {
@@ -69,8 +55,10 @@ $adf-permission-list-width: 100%;
$defaults: ( $defaults: (
--theme-primary-color: mat-color($primary), --theme-primary-color: mat-color($primary),
--theme-primary-color-default-contrast: mat-color($primary, default-contrast),
--theme-warn-color: mat-color($warn), --theme-warn-color: mat-color($warn),
--theme-accent-color: mat-color($accent), --theme-accent-color: mat-color($accent),
--theme-background-color: mat-color($background, background),
--theme-text-color: mat-color($foreground, text, 0.54), --theme-text-color: mat-color($foreground, text, 0.54),
--theme-text-bold-color: mat-color($foreground, text, 0.87), --theme-text-bold-color: mat-color($foreground, text, 0.87),
--theme-title-color: mat-color($foreground, text, 0.87), --theme-title-color: mat-color($foreground, text, 0.87),
@@ -79,7 +67,10 @@ $defaults: (
--header-background-image: url('/assets/images/mastHead-bg-shapesPattern.svg'), --header-background-image: url('/assets/images/mastHead-bg-shapesPattern.svg'),
--theme-card-background-color: mat-color($background, card), --theme-card-background-color: mat-color($background, card),
--theme-foreground-text-color: mat-color($foreground, text, 0.72), --theme-foreground-text-color: mat-color($foreground, text, 0.72),
--theme-foreground-text-bold-color: mat-color($foreground, text, 0.87) --theme-foreground-text-bold-color: mat-color($foreground, text, 0.87),
--theme-secondary-text-color: mat-color($foreground, secondary-text),
--theme-divider-color: mat-color($foreground, divider, 0.07),
--theme-dialog-background-color: mat-color($background, dialog)
); );
// propagates SCSS variables into the CSS variables scope // propagates SCSS variables into the CSS variables scope