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

Revert "fix(core): remove hardcoded style from ngx for toolbar component" #6430

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@
style="max-width: 200px;"
/>

<button fd-toolbar-item fd-button fd-toolbar-overflow-button fd-toolbar-overflow-button-menu label="Button" [fdMenu]="true" [compact]="true"></button>
<button fd-toolbar-item fd-button label="Button" [fdMenu]="true" [compact]="true"></button>

<fd-segmented-button fd-toolbar-item>
<button fd-button label="Left" [compact]="true"></button>
<button fd-button label="Middle" [compact]="true"></button>
<button fd-button label="Right" [compact]="true"></button>
</fd-segmented-button>

<button fd-toolbar-item fd-button fd-toolbar-overflow-button label="Button" [compact]="true"></button>
<button fd-toolbar-item fd-button fd-toolbar-overflow-button label="Button" [compact]="true"></button>
<button fd-toolbar-item fd-button label="Button" [compact]="true"></button>
<button fd-toolbar-item fd-button label="Button" [compact]="true"></button>
<fd-toolbar-spacer fd-toolbar-item [fixed]="true" [width]="'200px'"></fd-toolbar-spacer>
<button fd-toolbar-item fd-button fd-toolbar-overflow-button label="Button" [compact]="true"></button>
<button fd-toolbar-item fd-button fd-toolbar-overflow-button label="Button" [compact]="true"></button>
<button fd-toolbar-item fd-button fd-toolbar-overflow-button label="Button" [compact]="true"></button>
<button fd-toolbar-item fd-button label="Button" [compact]="true"></button>
<button fd-toolbar-item fd-button label="Button" [compact]="true"></button>
<button fd-toolbar-item fd-button label="Button" [compact]="true"></button>
</fd-toolbar>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<description>
If there isn’t enough room in a Toolbar, the [shouldOverflow]="true" can be used to move buttons to an overflow area.
A popover button will be created which will contain all the items in the overflow.
Make sure to include the <code class="code-snippet">fd-toolbar-item </code>directive in each Toolbar. <code class="code-snippet">fd-toolbar-overflow-button</code> for button and <code class="code-snippet">fd-toolbar-overflow-button-menu</code> for menu button in each Toolbar.
Make sure to include the <code class="code-snippet">fd-toolbar-item directive</code> in each Toolbar.
</description>
<component-example>
<fd-toolbar-overflow-example></fd-toolbar-overflow-example>
Expand Down
2 changes: 1 addition & 1 deletion e2e/wdio/core/pages/toolbar.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class ToolbarPo extends CoreBaseComponentPo {
overflowPriorityExample = 'fd-toolbar-overflow-priority-example';
overflowGroupingExample = 'fd-toolbar-overflow-grouping-example';
moreButton = ' [title="More"]';
overflowBody = '.fd-toolbar__overflow';
overflowBody = '.fd-toolbar__overflow__body';
alwaysButton = '[label="Always"]';
overflowGroupingButton = '#background-ex7' + this.button;
checkbox = '.fd-checkbox__label';
Expand Down
6 changes: 3 additions & 3 deletions libs/core/src/lib/toolbar/toolbar-form-label.directive.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Directive } from '@angular/core';
import { Component, ViewEncapsulation, ChangeDetectionStrategy, Directive } from '@angular/core';
import { ToolbarItemDirective } from './toolbar-item.directive';

@Directive({
// tslint:disable-next-line: directive-selector
selector: '[fd-toolbar-form-label]',
host: {
class: 'fd-form-label fd-toolbar__overflow-form-label fd-toolbar__overflow-form-label--text'
class: 'fd-form-label fd-toolbar__overflow__form-label'
}
})
export class ToolbarFormLabelDirective extends ToolbarItemDirective { }
export class ToolbarFormLabelDirective extends ToolbarItemDirective {}
4 changes: 2 additions & 2 deletions libs/core/src/lib/toolbar/toolbar-label.directive.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Directive } from '@angular/core';
import { Component, ViewEncapsulation, ChangeDetectionStrategy, Directive } from '@angular/core';
import { ToolbarItemDirective } from './toolbar-item.directive';

@Directive({
// tslint:disable-next-line: directive-selector
selector: '[fd-toolbar-label]',
host: {
class: 'fd-label fd-toolbar__overflow-label'
class: 'fd-label fd-toolbar__overflow__label'
}
})
export class ToolbarLabelDirective extends ToolbarItemDirective {}

This file was deleted.

10 changes: 0 additions & 10 deletions libs/core/src/lib/toolbar/toolbar-overflow-button.directive.ts

This file was deleted.

6 changes: 3 additions & 3 deletions libs/core/src/lib/toolbar/toolbar.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div #toolbar>
<ng-content></ng-content>
<span #overflowSpacer class="fd-toolbar__spacer"></span>
<span #overflowSpacer class="fd-toolbar__overflow-spacer"></span>
<ng-container *ngIf="shouldOverflow">
<fd-popover
placement="bottom-end"
[noArrow]="true"
class="fd-popover">
class="fd-popover fd-toolbar__overflow">
<fd-popover-control>
<button
*ngIf="overflowVisibility | async"
Expand All @@ -19,7 +19,7 @@
></button>
</fd-popover-control>
<fd-popover-body>
<div class="fd-toolbar__overflow" #overflowBody></div>
<div class="fd-toolbar__overflow__body" #overflowBody></div>
</fd-popover-body>
</fd-popover>
</ng-container>
Expand Down
122 changes: 122 additions & 0 deletions libs/core/src/lib/toolbar/toolbar.component.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,127 @@
@import '~fundamental-styles/dist/toolbar';


@mixin fd-rtl {
@at-root {
[dir='rtl'] &,
&[dir='rtl'] {
@content;
}
}
}


.fd-toolbar {
position: relative;

.fd-form-label {
align-self: auto;
}

&__overflow-spacer {
display: none;
}
}

.fd-toolbar > * {
flex-shrink: 0;
}

.fd-toolbar-fade-out {
visibility: hidden;
opacity: 0;
transition: visibility 0s linear 1s, opacity 1ms;
}

.fd-toolbar-fade-in {
visibility: visible;
opacity: 1;
transition: visibility 0s linear 0s, opacity 1s;
}

// TODO: Remove after merging https://github.com/SAP/fundamental-styles/pull/1851
$fd-namespace: fd;
$block: fd-toolbar;

.#{$block}__overflow__body {
font-size: .875rem;
font-size: var(--sapFontSize, .875rem);
line-height: 1.4;
line-height: var(--sapContent_LineHeight, 1.4);
color: #32363a;
color: var(--sapTextColor, #32363a);
font-family: "72", "72full", Arial, Helvetica, sans-serif;
font-family: var(--sapFontFamily, "72", "72full", Arial, Helvetica, sans-serif);
font-weight: 400;
-webkit-font-smoothing: antialiased;
box-sizing: border-box;
margin: 0;
border: 0;
display: flex;
flex-direction: column;
max-width: 20rem;
padding: .1875rem .375rem;

> *,
> .fd-button {
display: block;
text-align: left;
width: auto;

@at-root {
[dir="rtl"] &,
&[dir="rtl"] {
text-align: right;
}
}
}

> .#{$block}__separator {
height: 0.0625rem;
margin: 0.375rem 0.1875rem;
width: auto;
background-color: var(--sapToolbar_SeparatorColor);
}

.#{$block}__overflow__label {
&.#{$fd-namespace}-label {
margin: 0.375rem 0;
}
}

.#{$block}__overflow__form-label {
&.#{$fd-namespace}-form-label {
margin: 0.625rem 0 0.125rem 0;
}
}

.#{$block}__overflow__form-label,
.#{$block}__overflow__label {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}


.#{$block}__overflow__body {
max-height: 50vh;
overflow: auto;

.fd-button--menu {
display: flex;
align-items: center;
justify-content: space-between;
max-width: 100%;
}
}

.#{$block} > .#{$block}__overflow,
.#{$block} .#{$block}__overflow, {
margin-left: auto;

@include fd-rtl() {
margin-left: 0;
margin-right: auto;
}
}
4 changes: 0 additions & 4 deletions libs/core/src/lib/toolbar/toolbar.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { ToolbarItemDirective } from './toolbar-item.directive';
import { ToolbarSeparatorComponent } from './toolbar-separator.component';
import { ToolbarSpacerComponent } from './toolbar-spacer.component';
import { ToolbarLabelDirective } from './toolbar-label.directive';
import { ToolbarOverflowButtonDirective } from './toolbar-overflow-button.directive';
import { ToolbarOverflowButtonMenuDirective } from './toolbar-overflow-button-menu.directive';
import { ToolbarFormLabelDirective } from './toolbar-form-label.directive';
import { ToolbarOverflowPriorityDirective } from './toolbar-overflow-priority.directive';
import { ToolbarOverflowGroupDirective } from './toolbar-overflow-group.directive';
Expand All @@ -21,8 +19,6 @@ const components = [
ToolbarSeparatorComponent,
ToolbarFormLabelDirective,
ToolbarLabelDirective,
ToolbarOverflowButtonDirective,
ToolbarOverflowButtonMenuDirective,
ToolbarOverflowPriorityDirective,
ToolbarOverflowGroupDirective
];
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"classlist.js": "1.1.20150312",
"core-js": "3.7.0",
"focus-trap": "6.6.0",
"fundamental-styles": "0.20.0-rc.21",
"fundamental-styles": "0.19.0-rc.43",
"highlight.js": "10.7.2",
"intl": "1.2.5",
"jasminewd2": "2.2.0",
Expand Down